- #include <iostream>
- using namespace std;
- int main()
- {
- text:
- int score;
- cout<<"Enter your score: ";
- cin>>score;
-
- switch(score){
- case 90 ... 100:
- cout<<"優等"<<endl;
- break;
-
- case 80 ... 89:
- cout<<"甲等"<<endl;
- break;
-
- case 70 ... 79:
- cout<<"乙等"<<endl;
- break;
-
- case 60 ... 69:
- cout<<"丙等"<<endl;
- break;
-
- case 0 ... 59:
- cout<<"不及格"<<endl;
- break;
-
- default:
- cout<<"oops, information out of reach...";
- }
- system ("pause");
- goto text;
- return 0;
- }
複製代碼 |