I'm glad I could help.
It's still strange to me that one press of a key goes into two switch statemants
I might be easier for you to understand if we replace the event variable with just an integer. Your code would then be similar to this
int a = 5;
bool loc_chosen = false;
bool job_chosen = false;
switch (a)
{
case 5:
{
loc_chosen = true;
break;
}
}
if (loc_chosen)
{
switch (a)
{
case 5:
{
job_chosen = true;
break;
}
}
}
As you can see, 'a' never changes, so there's no reason why you wouldn't end up in the same 'case' for each switch statement.
could you elaborate how using enum would change anything
I didn't elaborate too much in my first post because there are many ways to handle states in a program. I didn't mean that it would fix your problem directly, just that it might make your logic a little easier to follow and extend. Using enums is just one option that is pretty simple and straightforward, but there are many other more sophisticated (and possibly overkill) options too for tracking state. You're right that you will still need some 'else' statements, but just using one variable for state tracking is a little easier to wrap your head around than using multiple booleans. Basically, the enum would just look something like this
enum class eState
{
ShowMenu1, // Equivalent to !loc_chosen && !job_chosen
ShowMenu2, // Equivalent to loc_chosen && !job_chosen
DoOtherThings // Equivalent to loc_chosen && job_chosen
};
and then you could make a variable of type eState instead of your current booleans to track what state you're in.