Code:#include <iostream> #include <iomanip> #include <string> #include <conio.h> using namespace std; void display_menu(); void tax(float); float total = 0, cash=0; int main() { char choice; bool more = true; cout << setiosflags(ios::showpoint) << setiosflags(ios::fixed) << setprecision(2); while(more) { //loop until the user wants more cout << "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n"; cout << "Welcome to Jimmy's Snack Bar!" << endl; display_menu(); cout << "Please enter the letter of your selection: "; cin >> choice; switch (choice) { case 'S': case 's': cout << "Sandwich - P30.00" << endl; total+=30; break; case 'C': case 'c': cout << "Chips - P50.00" << endl; total+=50; break; case 'P': case 'p': cout << "Pansit - P20.00" << endl; total+=20; break; case 'H': case 'h': cout << "Hotdog - P25.00" << endl; total+=25; break; case 'D': case 'd': cout << "Coke - P15.00" << endl; total+=15; display_menu(); break; case 'B': case 'b': cout << "Burger - P25.00" << endl; total+=25; break; case 'X' : case 'x': cout << "Canceled, please start over." << endl; total = 0; break; case 'T' : case 't': tax(total); cout<<"how much do you want to pay."<<endl; cin>>cash; cout << "Total : " << cash-(total + (total*0.12)) << endl; more = false; //stop the loop //_____________ break; default: cout << "Ooops! something went wrong.. :(\n\n"; return 0; //end the program } cout << "Your current total is: P "<< total << "\n\n"; } return 0; } void display_menu() { cout << endl; cout << "S - Sandwich P30.00" << endl; cout << "C - Chips P50.00" << endl; cout << "P - Pansit P20.00" << endl; cout << "H - Hotdog P25.00" << endl; cout << "D - Coke P15.00" << endl; cout << "B - Burger P25.00" << endl; cout << "X - Cancel sale and start over" << endl; cout << "T - Total the sale" << endl; cout << "All items have additional 12% tax." << endl; } void tax(float total) { cout << endl; cout << "Sub-total: " << total << endl; cout << "+ Tax : " << total*0.12 << endl; cout << "Total : " << total + (total*0.12) << endl; cout << "Total : " << cash-(total + (total*0.12)) << endl;//problem is this one }
i need help in this program. i was asking the user to input the cash. the program SHOULD THEN solve with the equation. but the program end up just asking the price and not solving at all.