本帖最後由 tonyh 於 2015-8-11 16:11 編輯
 - #include<iostream>
- #include<cstdlib>
- using namespace std;
- int main()
- {
- int score;
- cout<<"請輸入你的成績: ";
- cin>>score;
-
- if(score==100) //條件判斷時 等號要兩個
- cout<<"哇~太神了~滿分!"<<endl;
- else if(score<100 && score>=60) // && and的意思
- cout<<"恭喜你,及格了!"<<endl;
- else if(score<60 && score>0)
- cout<<"不及格,再加油!"<<endl;
- else if(score==0)
- cout<<"鴨蛋?斬!"<<endl;
- else
- cout<<"輸入錯誤.. 斬!"<<endl;
- system("pause");
- return 0;
- }
複製代碼 |