Go Back   CodingForums.com > :: Computing & Sciences > Computer Programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 03-21-2004, 06:11 PM   PM User | #1
Unknown
New Coder

 
Join Date: Jan 2004
Location: Illinois
Posts: 72
Thanks: 2
Thanked 0 Times in 0 Posts
Unknown is an unknown quantity at this point
C#: ReRunning the program

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
Unknown is offline   Reply With Quote
Old 03-21-2004, 11:21 PM   PM User | #2
djdante97
New Coder

 
Join Date: Dec 2002
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
djdante97 is an unknown quantity at this point
use a do-while loop.

do {
...
//switch statements
...
case 4:
exit = true;
break;
} while (exit == false)
djdante97 is offline   Reply With Quote
Old 03-22-2004, 04:59 AM   PM User | #3
Unknown
New Coder

 
Join Date: Jan 2004
Location: Illinois
Posts: 72
Thanks: 2
Thanked 0 Times in 0 Posts
Unknown is an unknown quantity at this point
oh.. that worked, but when the user is done with a task, the options are printed twice. DO you now hwy?
Unknown is offline   Reply With Quote
Old 03-23-2004, 12:50 AM   PM User | #4
djdante97
New Coder

 
Join Date: Dec 2002
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
djdante97 is an unknown quantity at this point
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.
djdante97 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:06 AM.


Advertisement
Log in to turn off these ads.