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

TOP

返回列表