1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110
|
int main ()
{
int coffee, juice, soda, tea, Manager_Special;
char choice;
int total_drinks;
do
{
cout << "Welcome to My Coffee Shop! We Offer:" << endl;
cout << "C - Coffee ($1.89)" << endl;
cout << "J - Juice ($2.99)" << endl;
cout << "S - Soda ($3.99)" << endl;
cout << "T - Tea ($4.99)" << endl;
cout << "M - Manager Special ($5.99)" << endl;
cout << "X - Done With Placing Order" << endl;
cout << "What drink would you like? Select C, J, S, T, M (or X to finish with order)" <<endl;
cin >> choice;
switch (choice)
{
case 'C':
cout << "Thank you. You have ordered the Coffee.\n" << endl;
coffee++;
break;
case 'c':
cout << "Thank you. You have ordered the Coffee.\n" << endl;
coffee++;
break;
case 'J':
cout << "Thank you. You have ordered the Juice.\n" << endl;
juice++;
break;
case 'j':
cout << "Thank you. You have ordered the Juice.\n" << endl;
juice++;
break;
case 'S':
cout << "Thank you. You have ordered the Soda.\n" << endl;
soda++;
break;
case 's':
cout << "Thank you. You have ordered the Soda.\n" << endl;
soda++;
break;
case 'T':
cout << "Thank you. You have ordered the Tea.\n" << endl;
tea++;
break;
case 't':
cout << "Thank you. You have ordered the Tea.\n" << endl;
tea++;
break;
case 'M':
cout << "Thank you. You have order the Manager Special.\n" << endl;
Manager_Special++;
break;
case 'm':
cout << "Thank you. You have order the Manager Special.\n" << endl;
Manager_Special++;
break;
case 'X':
break;
case 'x':
break;
default:
cout << "You did not enter C, J, S, T, M, or X!\n" << endl;
break;
}
}
while (choice != 'x' && choice != 'X');
total_drinks = coffee + juice + soda + tea + Manager_Special;
double total = (coffee * 1.89) + (juice * 2.99) + (soda * 3.99) + (tea * 4.99) + (Manager_Special * 5.99);
cout << "You have ordered " << total_drinks << " drinks."<< " Here is your order: " << endl;
cout << "Beverage" << setw(25) << "Quantity"<< endl;
if (coffee> 0)
{
cout << "Coffee" << setw (20) << coffee << endl;
}
if (juice> 0)
{
cout << "Juice" << setw (21) << juice << endl;
}
if (soda> 0)
{
cout << "Soda" << setw (22) << soda << endl;
}
if (tea> 0)
{
cout << "Tea" << setw (23) << tea << endl;
}
if (Manager_Special> 0)
{
cout << "Manager Special" << setw (11) << Manager_Special << endl;
}
cout << "Total: " << total << endl;
cout << "Done. Have a great day!" << endl;
return 0;
}
|