返回列表 發帖
本帖最後由 謝易錚 於 2016-5-24 09:59 編輯
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     int score;
  7.     re:
  8.     cout<<"來吧!輸入成績吧!:";
  9.     cin>>score;
  10.     switch(score)
  11.     {
  12.          case 80 ... 100:
  13.               cout<<"不錯嘛~"<<endl;
  14.               break;
  15.          case 70 ... 79:
  16.               cout<<"再接再厲囉!!" <<endl;
  17.               break;
  18.          case 60 ... 69:
  19.               cout<<"好可憐喔!!"<<endl;
  20.               break;
  21.          case 0 ... 59:
  22.               cout<<"你沒救了"<<endl;
  23.               break;
  24.          default:
  25.               cout<<"喂!別亂輸入啊"<<endl;
  26.      }
  27.     cout<<endl;
  28.     goto re;
  29.     system("pause");
  30.     return 0;
  31. }
複製代碼

TOP

返回列表