if...else if...else 敘述 (二)
- #include<iostream>
- using namespace std;
- int main()
- {
- int score;
- cout<<"請輸入你的成積: ";
- cin>>score;
- if(score==100)
- {
- cout<<"哇!滿分!你太神了!"<<endl;
- }
- else if(score>=60 && score<100)
- {
- cout<<"恭喜你及格了!"<<endl;
- }
- else if(score>=0 && score<60)
- {
- cout<<"不及格!打屁股!"<<endl;
- }
- else if(score==0)
- {
- cout<<"你..... (氣到說不出話來)"<<endl;
- }
- else //所有其他的狀況
- {
- cout<<"別來亂!"<<endl;
- }
- system("pause");
- return 0;
- }
複製代碼 |