本帖最後由 顏羽彤 於 2017-6-6 18:35 編輯
- #include<iostream>
- #include<cstdlib>
- using namespace std;
- int main()
- {
- int score;
- bool choice=true;
- cout<<"請輸入你的成績:(輸入000則代表離開)";
- while (choice)
- {
- cin>>score;
- if(score==000)
- {
- choice=false;
- cout<<"成績分級程式結束!"<<endl;
- }
- else
- {
- if(score<=100&&score>=90)
- {
- cout<<"優等"<<endl;
- }
- if(score<90&&score>=80)
- {
- cout<<"甲等"<<endl;
- }
- if(score<80&&score>=70)
- {
- cout<<"乙等"<<endl;
- }
- if(score<70&&score>=60)
- {
- cout<<"丙等"<<endl;
- }
- if(score<60&&score>=0)
- {
- cout<<"不及格"<<endl;
- }
- if(score>100 || score<0)
- {
- cout<<"輸入錯誤"<<endl;
- }
- cout<<"請輸入你的成績:";
- }
- }
- system("pause");
- return 0;
- }
複製代碼 |