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?