![]() |
|
#1
|
|||
|
|||
Need help with LoopingI have setup a vending machine program but I need to use looping to keep asking the user for money and accepting until $1.00 has been entered. For example, if the user enters .25 it will ask them to enter in more money. If they have entered in .25 and they enter in another .25 it should show that their new total is .50. I wanted to make the entire main function loop so that once the transaction is completed, the program will ask if you want to purchase a drink (Y/N) and once Y(yes) is chosen the program would loop again and start over with 0.00 and will ask to insert money again. If N(no) should be selected, the loop should exit and an output statement of what has been purchased should show up.
CPP / C++ / C Code:
|
|||
|
#2
|
||||
|
||||
Re: Need help with LoopingHarry, was not the other post with a loop for your nearly-same code helpful?
see here: http://www.gidforums.com/showpost.ph...8&postcount=11 __________________
Use the force...read the source!! WYCIWYG -- what you code is what you get! |
|
#3
|
||||
|
||||
Re: Need help with LoopingQuote:
Quote:
Now some comments on the program itself: CPP / C++ / C Code:
CPP / C++ / C Code:
CPP / C++ / C Code:
CPP / C++ / C Code:
CPP / C++ / C Code:
if list. CPP / C++ / C Code:
CPP / C++ / C Code:
Be more consistant in your indenting and brace placement. It will help you find errors quicker. See this for some ideas __________________
The 3 Laws of the Procrastination Society: 1) Never do today that which can be put off until tomorrow 2) Tomorrow never comes |
|
#4
|
|||
|
|||
Re: Need help with LoopingHow would I put into code where it asks the user for money(for example, if they insert .25. It will ask them for additional .75) because drinks cost $1.00. I am having the hardest time trying to figure that part of it out. Any help would be greatly appreciated. Thank you for the suggestions and I did make some of those changes and my program is working better than I had it before. Now all I need help in is what was mentioned above.
|
|
#5
|
||||
|
||||
Re: Need help with LoopingCode:
__________________
The 3 Laws of the Procrastination Society: 1) Never do today that which can be put off until tomorrow 2) Tomorrow never comes |
Recent GIDBlog
Install Adobe Flash - Without Administrator Rights by LocalTech
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Looping | fj8283888 | C++ Forum | 8 | 11-Apr-2006 21:12 |
| Sample looping (do/while) | Sabin044 | C++ Forum | 8 | 04-Feb-2006 11:39 |
| Problem with looping. | rina | C Programming Language | 2 | 04-Oct-2005 06:37 |
| ask looping | likeit | C Programming Language | 4 | 26-Jul-2005 19:49 |
| for looping prob | Rosmayati | C Programming Language | 1 | 30-Jun-2004 11:39 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The