Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- char again = 'y' ;
- int food;
- int price;
- int ctrlfood = 0;
- while (again == 'Y' || again=='y')
- {
- cout << "1.大麥克\t$109\n2.麥香雞\t$89\n3.炸雞餐\t$119\n4.雙層牛肉堡\t$129" << endl;
- while (ctrlfood == 0)
- {
- cout << "請輸入你想點的:";
- cin >> food;
- cout << endl;
- switch (food)
- {
- case 1:
- ctrlfood = 1;
- price = 109;
- cout << "你點的餐價格為$" << price << endl;
- break;
- case 2:
- ctrlfood = 1;
- price = 89;
- cout << "你點的餐價格為$" << price << endl;
- break;
- case 3:
- ctrlfood = 1;
- price = 119;
- cout << "你點的餐價格為$" << price << endl;
- break;
- case 4:
- ctrlfood = 1;
- price = 129;
- cout << "你點的餐價格為$" << price << endl;
- break;
- default:
- ctrlfood = 0;
- cout << "你不會點餐喔" << endl;
- }
- cout << endl;
- }
- cout << endl;
- cout << "請問還要繼續點餐嗎(Y/N)?";
- cin >> again;
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment