- #include<iostream>
- #include<cstdlib>
- using namespace std;
- int main()
- {
- int ans;
- cout<<"蘋果的英文是?(1)apple(2)book(3)pig"<<endl;
- cout<<"請輸入選項:" ;
- cin>>ans;
- switch(ans){
- case 1:
- cout<<"答對了!"<<endl;
- break;
- case 2:
- cout<<"答錯了!book是書" <<endl;
- break;
- case 3:
- cout<<"答錯了!pig是豬"<<endl;
- break;
- default:
- cout<<"沒這選項!"<<endl;
- }
- system("pause");
- return 0;
- }
複製代碼 |