- #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)
- cout<<"恭喜你及格了,給你糖吃!"<<endl;
- else if(score<60 && score>0)
- cout<<"不及格!打屁股!"<<endl;
- else if(score==0)
- cout<<"零分?斬!"<<endl;
- else
- cout<<"輸入錯誤!斬!"<<endl;
- system("pause");
- return 0;
- }
複製代碼 |