what wrong with my program.why it is cannot run?

#include <iostream.h>
#include <iomanip>

const float TAX=.06;

void menu();

int main()
{
float total=0;
bool done=false;
char choice;
menu();
cout << setiosflags(ios::showpoint) << setiosflags(ios::fixed) << setprecision(2);
while (!done) {
cout << "Your current sub-total is: $" << total << endl;
cout << "Enter your selection (q to quit, ? for menu): ";
cin >> choice;
cout << endl;
switch (choice) {
case '?':
menu();
break;
case 'S': case 's':
cout << "Sandwitch, $7.50" << endl << endl;
total+=7.5;
break;
case 'C': case 'c':
cout << "Chips, $2.00" << endl << endl;
total+=2;
break;
case 'B': case 'b':
cout << "Brownie, $1.75" << endl << endl;
total+=1.75;
break;
case 'R': case 'r':
cout << "Regular drink, $2.50" << endl << endl;
total+=2.5;
break;
case 'L': case 'l':
cout << "Large drink, $4.75" << endl << endl;
total+=4.75;
break;
case 'X': case 'x':
cout << "Cancel, start over." << endl << endl;
total=0;
break;
case 'T': case 't':
cout << "Sub-total: " << total << endl;
cout << "+ Tax : " << total*TAX << endl;
cout << "Total : " << total+total*TAX << endl << endl;
break;
case 'Q': case 'q':
done=true;
break;
default:
menu();
}
}
}

void menu() {
cout << endl;
cout << "S - Sandwich $7.50" << endl;
cout << "C - Chips $2.00" << endl;
cout << "B - Brownie $1.75" << endl;
cout << "R - Regular drink $2.50" << endl;
cout << "L - Large drink $4.75" << endl;
cout << "X - cancel and start over" << endl;
cout << "T - total the sale" << endl;
cout << endl;
cout << "All items are subject to sales tax. 6%.";
cout << endl << endl;
}
closed account (S6k9GNh0)
Well, I see multiple places where you would get an error. Is it giving you an error? If so please post the error inside the box.

And next you post code use the CODE tags. Seriously, it gets old if you don't use these
Topic archived. No new replies allowed.