![]() |
|
#1
|
|||
|
|||
Question on how to apply do while loopHello I have the following code below. I need the different menu choices in main to keep repeating until the user decides to enter 5 which then terminates the program. I was told to use a do while statement. I have tried it and It did not work right. It would stop after only 2 tries through the code. I also tried enclosing the whole chunk of code in a do while loop but that did not work either. Can anyone help me?
JAVA Code:
|
|||
|
#2
|
||||
|
||||
Re: Question on how to apply do while loopSeems that the 'do' could be placed just before the options display, and then place the 'while' portion after the last option check, which, in the above code, would be after the last option check of '2'.
So that the code within the loop would be similar to this: JAVA Code:
__________________
Use the force...read the source!! WYCIWYG -- what you code is what you get! |
Recent GIDBlog
Programming ebook direct download available by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Text-Based Roulette Game | mfm1983 | C++ Forum | 5 | 29-Nov-2006 13:20 |
| Simple question about while loop | Lej | C++ Forum | 6 | 07-Aug-2005 14:57 |
| Array 1 dimensional help please asap | lion123 | C Programming Language | 10 | 18-Feb-2005 22:53 |
| Nested for loop with function | Tori | C++ Forum | 11 | 08-Nov-2004 14:02 |
| C switch / loop issue | spudtheimpaler | C Programming Language | 4 | 20-Feb-2004 21:45 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The