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

TOP

返回列表