Hi im in computer science one and am just starting out. I wrote this program but it has some errors. I was wondering if you could help me fix the errors. It has to repeatedly display the menu and running total, etc. The tax HAS to be added in a separate function, which I can't get right. It needs the total from the main function. Thanks for any help you can give. I really appreciate it.
// Rodeo Snack Bar program
#include <iostream>
#include <iomanip>
using namespace std;
void display_menu();
void tax();
float total = 0;
int main()
{
char choice;
display_menu();
cout << setiosflags(ios::showpoint) << setiosflags(ios::fixed) << setprecision(2);
while {
cout << "Welcome to the Rodeo Snack Bar!" << endl;
cout << "Your current total is: $"<< total << endl;
cout << "Please enter the letter of your selection: ";
cin >> choice;
cout << endl;
switch (choice) {
case 'S': case 's':
cout << "Sandwich - $5.00" << endl;
total+=5;
display_menu();
break;
case 'C': case 'c':
cout << "Chips - $1.50" << endl;
total+=1.5;
display_menu();
break;
case 'P': case 'p':
cout << "Pickle - $0.75" << endl;
total+=.75;
display_menu();
break;
case 'B': case 'b':
cout << "Brownie - $1.00" << endl;
total+=1;
display_menu();
break;
case 'R': case 'r':
cout << "Regular Drink - $2.00" << endl;
total+=2;
display_menu();
break;
case 'L': case 'l':
cout << "Large Drink - $3.50" << endl;
total+=3.5;
display_menu();
break;
case 'X' : case 'x':
cout << "Canceled, please start over." << endl;
total = 0;
display_menu();
break;
case 'T' : case 't':
tax();
break;
default:
display_menu();
}
}
}