本帖最後由 t2364705 於 2012-4-14 16:19 編輯
- #include<iostream>
- using namespace std;
- int main()
- {
- int answer;
- cout<<"猜猜我今年幾歲?"<<endl;
- cout<<"(1) 五歲 (2) 十歲 (3) 十五歲 (4) 二十歲"<<endl;
- cin>>answer;
- cout<<endl;
- switch (answer)
- {
- case 1:
- cout<<"我有那麼年輕嗎!";
- break;
- case 2:
- cout<<"賓果!你答對了!";
- break;
- case 3:
- cout<<"白痴!我沒有那麼老!";
- break;
- case 4:
- cout<<"你是來亂的喔!";
- default:
- cout<<"輸入錯誤";
- }
- system("pause");
- return 0 ;
- }
複製代碼 |