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