What you need to do is use a while loop.
One way to do this is to initialize option to an arbitrary value that isn't 1,2, or your escape code:
char option = 4;
Then you put the rest of the code after that in a while loop. The condition for the loop being that option != 'q', or whatever you want the escape code to be.
So every time it loops, it will ask for the option again. If you input an invalid value, it will ask you for a value again. If you input 1 or 2, it will enter the correct 'if' statement. If you input 'q' or whatever your escape code is, it will break the loop and end the program.
A second way to do this is to not initialize option to anything. Leave it at:
char option;
Then your while loop will encompass the rest of the code. The condition for the while loop will be 1 or true:
while(true)
So the only way to end it will be to use a break statement.
Then, after you cin >> option; You have an if statement that says:
if(option == 'q') //or other escape code
break;
Both those ways will do the exact same thing. You'll find in programming that you can do things multiple ways, its up to you to decide which way is the best (efficiency etc.). Of course with a basic example like this efficiency doesn't matter, that's just for when you get into data
structures.
---
class EOSERV {
Programmer | Oldbie
Open source EO Client: https://github.com/ethanmoffat/EndlessClient
};