- #include<iostream>
- #include<cstdlib>
- using namespace std;
- int main()
- {
- char option;
- cout<<"請問豬有幾隻腳? (A)一隻 (B)兩隻 (C)三隻 (D)四隻"<<endl;
- cout<<"請作答: ";
- cin>>option;
- switch(option)
- {
- case 'A':
- cout<<"用跳的嗎?"<<endl;
- break;
- case 'B':
- cout<<"沒吃過豬肉也看過豬走路!"<<endl;
- break;
- case 'C':
- cout<<"你是豬啊?"<<endl;
- break;
- case 'D':
- cout<<"答對了!"<<endl;
- break;
- default:
- cout<<"沒有"<<option<<endl;
- }
- system("pause");
- return 0;
- }
複製代碼 |