Repeat a Function in main()

I am trying to make it that as soon as a void is finished and goes to the main() function it goes back into the void. Is this possible? I am trying to make a little RPG that has amenu and everytime the combat is over it will ask you for a selection: (C)ombat, (S)tats or (E)xit?(Switch Statement) I have it working but as soon as The combat/stat is over it will go in the main and repeat the Switch Statement.
closed account (o1vk4iN6)
Posting some code using [ code ] tags will help see the problem.

It sounds like you either need to make your function return a value so it knows where to proceed.
I figured it out, I used a while statement that never changes. Its probably not the best way to do it. But it works for me. If a Mod/Admin could delete this post would be great, I feel pretty stupid hehe...
What do you mean? if you want to open up a menu you would want a while loop inside your main loop as in:
1
2
3
4
while(menuPulled){
does switch statement
menuPulled = false
}


menuPulled would be a bool that is set to true and runs while true.
Thats pretty much what I did,
1
2
3
4
5
int dont_change=1;
while(dont_change=1)
{
main_menu();
}

My menu void has everything I need in it.
while(dont_change=1) is everytime true, because you assign the value 1 to dont_change.
Try this:
while(dont_change == 1) == is the logical operator.
ohh That is why my termination didnt work. thanks
i simple way to write that would be using a bool(true false statemnet), you could really shorten that down into
1
2
3
while(dont_change){
run code
}
Topic archived. No new replies allowed.