- #include<iostream>
- #include<cstdlib>
- using namespace std;
- int main()
- {
- char ans;
- cout<<"question"<<endl;
- cout<<"烏龜有幾隻腳,(a)1(b)2(c)3(d)4"<<endl;
- cout<<"answer:"<<endl;
- cin>>ans;
- switch(ans)
- {
- case 'a':
- case 'A':
- cout<<"答錯"<<endl;
- break;
- case 'b':
- case 'B':
- cout<<"答錯"<<endl;
- break;
- case 'c':
- case 'C':
- cout<<"答錯"<<endl;
- case 'd':
- case 'D':
- cout<<"答對"<<endl;
- break;
- default:
- cout<<"輸入錯誤!"<<endl;
- }
- system("pause");
- return 0;
- }
複製代碼 |