Take my example up there and add to it:
Code:
while (1) // keep looping until we get something
{
cout << "Where Would you like to go?\nHome\nJob\nStore\n";
if (y == 'h')
{
HomeFunction(); // user defined function for Home
break;
}
else if (y == 'j')
{
JobFunction(); // user defined function for picking Job
break;
}
else
{
cout << "Not a valid character.\n";
}
}
Now if you select 'j' it will take you to Job, 'h' will take you home, any other character entered will print "Not a valid character." and continue the while loop.
Also if you want it to loop back to the start after you handle the selected function, remove the breaks, and don't forget to put in an exit condition, i.e.:
Code:
// If q is pressed, break out of loop
if (y == 'q')
{
break;
}
Is that what you wanted?