- #include<iostream>
- using namespace std;
- int main()
- {
- int answer;
- cout<<"猜猜看我幾歲??"<<endl;
- cout<<"(1)2歲(2)5歲(3)12歲(4)30歲"<<endl;
- cout<<"請作答...";
- cin>>answer;
- cout<<endl;
- switch(answer)
- {
- case 1:
- cout<<"2歲??你兩歲寫程式給我看!!";
- break;
- case 2:
- cout<<"5歲?嗯嗯...有可能,不過我沒那嚜麼聰明!!";
- break;
- case 3:
- cout<<"12歲!聰明答對了!!";
- break;
- case 4:
- cout<<"30歲?!夭壽!!我沒那麼老!!";
- break;
- default:
- cout<<"沒這種選擇!!";
-
- }
- cout<<endl;
- system("pause");
- return 0;
- }
複製代碼 |