- #include<iostream>
- #include<cstdlib>
- using namespace std;
- int main()
- {
- char ans;
- re:
- system("cls");
- cout<<"<小米的腦殘問答>"<<endl;
- cout<<"請問豬有幾隻腳? (A)一隻 (B)兩隻 (C)三隻 (D)四隻"<<endl;
- cout<<"請勿一次輸入多個答案,一次輸入一個答案"<<endl;
- cout<<"請作答: ";
- 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");
- goto re;
- return 0;
- }
複製代碼 |