<分区>
输入正确的总金额。任何帮助将不胜感激,谢谢。
#include <iostream>
using namespace std;
int main()
{
float cost2 = 0;
char ch;
cout << "1. Water \t\tRs.10" << endl;
cout << "2. Cola \t\tRs.20" << endl;
cout << "3. Lemonade \t\tRs.15" << endl;
cout << "Enter your choice: " << endl;
cin >> ch;
switch(ch) {
case 1: {
cost2 += 10; // trying to add 10 if input (ch) is 1
break;
}
case 2: {
cost2 += 20;
break;
}
case 3: {
cost2 += 15;
break;
}
}
cout << "The total before tax is: Rs." << cost2 << endl;
}