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

TOP

返回列表