返回列表 發帖
  1. using namespace std;
  2. int main()
  3. {
  4.     int x;
  5.     cout<<"請輸入你的成績"<<endl;
  6.     cin>>x;
  7.     switch(x)
  8.     {
  9.         case 80 ... 100:
  10.             cout<<"甲"<<endl;
  11.             break;
  12.         case 70 ... 79:
  13.             cout<<"丙"<<endl;
  14.             break;
  15.         case 60 ... 69:
  16.             cout<<"甲"<<endl;
  17.             break;
  18.         case 0 ... 59:
  19.             cout<<"不及格"<<endl;
  20.             break;
  21.         default:
  22.             cout<<"輸入錯誤"<<endl;
  23.     }
  24.     system("pause");
  25.     return 0;
  26. }
複製代碼

TOP

返回列表