返回列表 發帖
  1. #include<iostream>
  2. using namespace std;

  3. int main(){
  4.    
  5.     int score;
  6.     cout<<"請輸入你的成績:";
  7.     cin>>score;
  8.    
  9.     switch(score){
  10.                    case 90 ... 100:
  11.                         cout<<"優等"<<endl;
  12.                         break;
  13.                    case 80 ... 89:
  14.                         cout<<"甲等"<<endl;
  15.                         break;
  16.                    case 70 ... 79:
  17.                         cout<<"乙等"<<endl;
  18.                         break;
  19.                    case 60 ... 69:
  20.                         cout<<"丙等"<<endl;
  21.                         break;
  22.                    case 0 ... 59:
  23.                         cout<<"不及格"<<endl;
  24.                         break;
  25.                    default:
  26.                            cout<<"輸入錯誤"<<endl;
  27.     }
  28.    
  29.     system("pause");
  30.     return 0;
  31. }
複製代碼

TOP

返回列表