![]() |
|
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Newbie
Join Date: Jan 2007
Location: Hershey, the sweetest place on earth
Posts: 19
Rep Power: 0
![]() |
Point-of-Sale
Hello! I'm kind of new to programming so please help. I have been working on a program that would present a menu so the user can choose what they wanted. Every time they chose something the program would repeatedly display the menu as the sale is being totaled. Currently, when I try to run my program it shows a never ending loop.
#include <iostream.h> // included heading
float totalsale (float s);
int main()
{
int choice;
float sale = 0.00;
do
{
cout << "What would you like to buy from the menu.\n";
cout << "S - Sandwich\n";
cout << "C - Chips\n";
cout << "B - Brownie\n";
cout << "R - Regular Drink\n";
cout << "L - Large Drink\n";
cout << "X - Cancel Sale and Start over\n";
cout << "T - Total Sale\n";
cin >> choice;
cout << "The current cost of your meal is " << sale << endl;
} while (choice != 'T');
switch(choice)
{
case 'S':
sale = sale + 2.99;
break;
case 'C':
sale = sale + 0.99;
break;
case 'B':
sale = sale + 0.99;
break;
case 'R':
sale = sale + 0.99;
break;
case 'L':
sale = sale + 1.29;
break;
case 'X':
sale = 0.00;
break;
}
float totalsale (sale);
return 0;
}
float totalsale (float function_s)
{
return function_s;
}I'm not completely finished with it. Could someone tell me what I'm doing wrong? |
|
|
|
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| 3d Graphics. | Sane | Other Scripting Languages | 54 | Apr 7th, 2006 10:38 PM |
| Add - ins for Power Point 2003 | christophersong | Visual Basic | 0 | Dec 19th, 2005 4:32 PM |
| How to make an array of pointers-to-char point to strings | aznluvsmc | C | 38 | Sep 21st, 2005 8:45 AM |
| Finding a point on a circle | TooDice | Other Programming Languages | 15 | Jun 23rd, 2005 8:56 AM |
| various questions on class Point methods | nocturna_gr | Java | 1 | May 7th, 2005 1:45 PM |