| | |
Cannot end my loop properly
Thread Solved |
•
•
Join Date: Jun 2009
Posts: 1
Reputation:
Solved Threads: 0
I am writing a program in which the user enters a number between 1 and 3 (3 meaning that he/she would like to quit) and I am using a switch function within a do-while loop. I am trying to get the program to end the loop when the user enters the number 3. However, my program is only continuing the loop when the user enters 3. Can anyone help me fix this please? Thanks so much!
-Mikaela
-Mikaela
•
•
Join Date: Apr 2008
Posts: 50
Reputation:
Solved Threads: 3
Follow the logic flow line by line, you are asking for the user to enter the price for the item after they make the choice between 1,2, or 3 regardless of which choice they made.
The do...while loop involving the switch statement doesn't come into play until after the user has entered a price. So unless they enter a price of 3, this will never exit.
The do...while loop involving the switch statement doesn't come into play until after the user has entered a price. So unless they enter a price of 3, this will never exit.
![]() |
Similar Threads
- Help, Help with Traffic Simulation program (Java)
- End a for loop (C++)
- while loop dont seem to work (C++)
- help me understand end of do while loop (C++)
- Problem with while loop... probably common (C++)
- for loop help (C++)
Other Threads in the IT Professionals' Lounge Forum
- Previous Thread: Please help me decide - MSc Computing, where and why
- Next Thread: Decompiler
| Thread Tools | Search this Thread |
1gbit advertising advice amazon answers archive british broadband business businessprocesses career carrier censorship cern china cio collectiveintelligence connectivity consumer consumers corporateearnings datatransfer debtcollectors dictionary digg digital ebay ecommerce email employment environment facebook food government grid high-definition hottub infodelivery infotech intel internet interview ipod isp japan kindle lhc library malware marketing mit moonfruit news onlineshopping piracy piratebay pope porn program questions r&d religion remoteworking research retail security sex shopping simple skype smallbusiness smb sms socialmedia socialnetworking software softwareengineer spam speed spending startrek statistics stocks study stumbleupon survey tabletpc technology touch-screen touchscreen twitter uk videoinprint voips web webdeveloper windows words





