- #include<iostream>
- #include<cstdlib>
- using namespace std;
- int main(){
- int option;
- cout<<"請輸入您要買的飲料(1.咖啡 2.牛奶 3.紅茶): ";
- cin>>option;
- switch (option) {
- case 1:
- cout<<"你點的是咖啡:285元"<<endl;
- break;
- case 2:
- cout<<"你點的是牛奶:185元"<<endl;
- break;
- case 3:
- cout<<"你點的是紅茶:85元"<<endl;
- break;
- default:
- cout<<"輸入錯誤"<<endl;
-
- }
- system("pause");
- return 0;
- }
複製代碼 |