Professional Documents
Culture Documents
02 using namespace std;
03
04 int main()
05 {
06 double tipPercentage, tipResults;
07 double tips[3] = {0.13, 0.15, 0.20};
08 char choice;
09
10
11 cout <<"Please enter your bill amount: ";
12 cin >> tipPercentage;
13
14 cout<<endl;
15
16 cout <<"Please choose one of the following tip percentages (1, 2, 3):\n ";
17 cout <<"1. 13%\n ";
18 cout <<"2. 15%\n ";
19 cout <<"3. 20%\n ";
20
21 cout << endl;
22
23 choice=0;
24
25 int i;
26 for (i = 0; i < 1; i++)
27 switch (choice)
28 {
29 case 0: cout << endl;
30 break;
31 case 1:
32 cout <<"You chose 13%";
33 break;
34 case 2:
35 cout <<"You chose 15%";
36 break;
37 case 3:
38 cout <<"You chose 20%";
39 break;
40 default:
41
42 tipResults = tipPercentage * tips[choice];
43 cout<<"Your tip for the bill is " << tipResults;
44 cout << endl;
45 return EXIT_SUCCESS;
46 }
47 }