返回列表 發帖
  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5.     text:
  6.     int score;
  7.     cout<<"Enter your score: ";
  8.     cin>>score;
  9.    
  10.     switch(score){
  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<<"oops, information out of reach...";
  33. }
  34. system ("pause");
  35. goto text;
  36. return 0;
  37. }
複製代碼

TOP

返回列表