返回列表 發帖
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     int a;
  7.     re:
  8.     cout<<"請輸入你的成績: ";
  9.     cin>>a;
  10.     switch(a)
  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.     }
  30.     goto re;
  31.     system("pause");
  32.     return 0;
  33. }
複製代碼

TOP

  1. #include<cstdlib>
  2. #include<iostream>
  3. using namespace std;
  4. int main()
  5. {
  6.     int a=0;
  7.     while(a<101)
  8.     {
  9.     cout<<a<<endl;         
  10.     a+=3;
  11.     }
  12.     system ("pause");
  13.     return 0;
  14. }
複製代碼

TOP

返回列表