Hey,
I'm trying to get my program so that, at any question, pressing the 'r' key will return to, main (). However i am also trying to carry out other if-else funtions using numbers and i have managed to get myself confused.
From what I gather, you want to give the user a bunch of options, and if the user inputs 0 or R for any of those options, you'll start over? If so, you could do something like this:
int main()
{
bool Running = true;
string choice;
while(Running)
{
cout << "Choose: 1) This, 2) This, R) Restart\n> ";
cin >> choice;
switch(choice)
{
case"1":
// Do this
break;
case"2":
// Do this
break;
case"R": // or use ifstatements to have R || r
// User restarts
continue;
break;
default:
// Error
break;
}
cout << "Choose next part: 1)...";
// switch/ifstatements here
}
}
Or to go back to a previous section, you could use progress markers: