- #include<iostream>
- #include<cstdlib>
- using namespace std;
- int main(){
- char ans;
- cout<<"請問1+1=?";
- cout<<"\n(A)1 (B)2 (C)3 (D)4\n你的答案:";
- cin>>ans;
- switch(ans){
- case 'A':
- case 'a':
- cout<<"x為正整數 x+x一定>x";
- break;
- case 'B':
- case 'b':
- cout<<"正確";
- break;
- case 'C':
- case 'c':
- cout<<"數學真好";
- break;
- case 'D':
- case 'd':
- cout<<"無言...";
- break;
- default:
- cout<<"輸入錯誤";
- }
- cout<<"\n";
-
-
- system("pause");
- return 0;
-
- }
複製代碼 |