View Full Version : C#: ReRunning the program

03-21-2004, 06:11 PM
My program consists of mainly a switch statment that determines what task the user wants. I give the user a list of 4 task and he picks one. What I'm trying to do it make it where once the user is done with a task the program runs again without exiting. Like making the switch statment run again. Anyone know how. I tried putting the program into a function and then at the end of the function calling it self again, but it didn't work. Help

BTW: Its a command prompt program :P

03-21-2004, 11:21 PM
use a do-while loop.

do {
//switch statements
case 4:
exit = true;
} while (exit == false)

03-22-2004, 04:59 AM
oh.. that worked, but when the user is done with a task, the options are printed twice. DO you now hwy?

03-23-2004, 12:50 AM
make sure you're not calling the function again (recursing) at the end of the function, or after the do-while loop.. without seeing the code i can't really tell.