返回列表 發帖
  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5. int answer;     
  6. cout<<"請問賈伯斯甚麼時候死的?"<<endl;
  7. cout<<"(1)2011年(2)987546986585年(3)1784年(4)1年"<<endl;   
  8. cin>>answer;   
  9. cout<<endl;   
  10. switch(answer)   
  11. {
  12. case 1:
  13.        cout<<"Yes!!";
  14.        break;
  15. case 2:
  16.        cout<<"去死!!都還沒到!!!!!!!!!";
  17.        break;
  18. case 3:
  19.        cout<<"那是國父!!!!!嘯嘿!!";
  20.        break;
  21. case 4:
  22.        cout<<"錯!!!";
  23.        break;
  24. default:
  25.        cout<<"你來亂的喔!";
  26. }   
  27. cout<<endl;   
  28. system("pause");   
  29. return 0;      
  30. }
複製代碼

TOP

  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5.    int answer;     
  6.    cout<<"請問賈伯斯甚麼時候死的?"<<endl;
  7.    cout<<"(1)2011年(2)987546986585年(3)1784年(4)1年"<<endl;   
  8.    cin>>answer;   
  9.    cout<<endl;   
  10.    if(answer==1)   
  11.    {
  12.                  
  13.      cout<<"Yes!!";
  14.                  
  15.    }else if(answer==2)
  16.    {
  17.       
  18.       
  19.       cout<<"去死!!都還沒到!!!!!!!!!";
  20.       
  21.    }else if(answer==3)
  22.    {
  23.       
  24.       
  25.        cout<<"那是國父!!!!!嘯嘿!!";
  26.       
  27.     }else if(answer==4)
  28.     {
  29.       
  30.         cout<<"錯!!!";
  31.       
  32.       
  33.     }else

  34.     {
  35.       
  36.       
  37.        cout<<"你來亂的喔!";
  38.       
  39.     }      
  40.       

  41. cout<<endl;   
  42. system("pause");   
  43. return 0;      
  44. }
複製代碼

TOP

返回列表