返回列表 發帖
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.    
  7.     char x;
  8.     cout<<"1+1=?  (a)1 (b)2 (c)3 (d)4"<<endl;
  9.     cin>>x;
  10.     switch(x)
  11.     {
  12.         case'a':
  13.         case'A':
  14.             cout<<"你確定?"<<endl;
  15.             break;
  16.         case 'b':
  17.         case 'B':
  18.             cout<<"答對了,好棒棒!"<<endl;
  19.             break;
  20.         case 'c':
  21.         case 'C':
  22.             cout<<"這麼簡單也不會?"<<endl;
  23.             break;
  24.         case 'd':
  25.         case 'D':
  26.             cout<<"沒救了!"<<endl;
  27.             break;
  28.         default:
  29.             cout<<"你亂輸"<<endl;
  30.     }
  31.    
  32.     system("pause");
  33.     return 0;   
  34. }
複製代碼

TOP

返回列表