返回列表 發帖
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     re:
  7.     int n;
  8.     cout<<"請輸入您的成績: ";
  9.     cin>>n;
  10.     switch(n)
  11.     {
  12.         case 90 ... 100:
  13.             cout<<"U等"<<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.         case 0 ... 59:
  24.             cout<<"可悲阿"<<endl;
  25.             break;         
  26.         default:
  27.             cout<<"你在幹嘛麼,打字都不會!!!"<<endl;
  28.     }
  29.     goto re;
  30.     system("pause");
  31.     return 0;
  32. }
複製代碼
༼ つ ◕_◕ ༽つ༼ つ ◕_◕ ༽つ༼ つ ◕_◕ ༽つ

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     re:
  7.     int n;
  8.     cout<<"請輸入您的成績: ";
  9.     cin>>n;
  10.     switch(n)
  11.     {
  12.         case 90 ... 100:
  13.             cout<<"U等"<<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.         case 0 ... 59:
  24.             cout<<"可悲阿"<<endl;
  25.             break;         
  26.         default:
  27.             cout<<"你在幹嘛麼,打字都不會!!!"<<endl;
  28.     }
  29.     goto re;
  30.     system("pause");
  31.     return 0;
  32. }
複製代碼
༼ つ ◕_◕ ༽つ༼ つ ◕_◕ ༽つ༼ つ ◕_◕ ༽つ

TOP

返回列表