- #include<iostream>
- #include<cstdlib>
- using namespace std;
- int main()
- {
- int option;
- cout<<"請輸入您要點的飲料(1.咖啡 2.牛奶 3.紅茶 ): ";
- cin>>option;
- switch(option)
- {
- case 1 :
- cout<<"您點的是咖啡"<<endl;
- break;
- case 2 :
- cout<<"您點的是牛奶"<<endl;
- break;
- case 3 :
- cout<<"您點的是紅茶"<<endl;
- break;
- default :
- cout<<"目前不提供其他飲料"<<endl;
- }
- system("pause");
- return 0;
- }
複製代碼 |