- #include<iostream>
- #include<cstdlib>
- using namespace std;
- int main()
- {
- re:
- int score;
- cout<<"請輸入分數:";
- cin>>score;
- switch(score)
- {
- case 80 ... 100:
- cout<<"甲等,非常好"<<endl;
- break;
- case 79 ... 70:
- cout<<"乙等,再加油"<<endl;
- break;
- case 60 ... 69:
- cout<<"丙等,很危險"<<endl;
- break;
- case 0 ... 59:
- cout<<"不及格,去參加補救教學"<<endl;
- break;
- default:
- cout<<"輸入錯誤"<<endl;
- }
- goto re;
- system("pause");
- return 0;
- }
複製代碼 |