返回列表 發帖

if...else 敘述

本帖最後由 tonyh 於 2012-3-28 14:05 編輯
  1. #include<iostream>
  2. using namespace std;
  3. int main()
  4. {
  5.       int score;               
  6.       cout<<"請輸入你的成績:";
  7.       cin>>score;
  8.       cout<<"你的成績是"<<score<<"分"<<endl;
  9.       if(score>=60)
  10.       {
  11.           cout<<"恭喜你及格了!"<<endl;
  12.       }else
  13.       {
  14.           cout<<"不及格!請再加油!"<<endl;                                      
  15.       }            
  16.       system("pause");
  17.       return 0;   
  18. }
複製代碼

  1. #include<iostream>
  2. using namespace std;
  3. int main()
  4. {
  5.       int score;               
  6.       cout<<"請輸入你的成績:";
  7.       cin>>score;
  8.       cout<<"你的成績是"<<score<<"分"<<endl;
  9.       if(score>=60)
  10.       {
  11.           cout<<"恭喜你及格了"<<endl;
  12.       }else
  13.       {
  14.           cout<<"不及格,請再加油"<<endl;                                      
  15.       }
  16.       
  17.                      
  18.       system("pause");
  19.       return 0;   
  20. }
複製代碼

TOP

  1. #include<iostream>
  2. using namespace std;
  3. int main()
  4. {
  5.     int score;
  6.     cout<<"請輸入你的成績:";
  7.     cin>>score;
  8.     cout<<"你的成績是"<<score<<"分"<<endl;
  9.     if(score>=60)
  10.     {
  11.      cout<<"恭喜你!贏了。"<<endl;
  12.     }else
  13.      cout<<"恭喜你!輸了。"<<endl;                       
  14.     {               
  15.     }
  16.     system("pause");
  17.     return 0;
  18. }
複製代碼

TOP

  1. #include<iostream>
  2. using namespace std;
  3. int main()
  4. {   
  5.     int score;
  6.    
  7.     cout<<"請輸入你的成績:";
  8.     cin>>score;
  9.     cout<<"你的成績是"<<score<<"分"<<endl;
  10.     if(score>=60)
  11.     {
  12.        cout<<""<<endl;            
  13.     }else
  14.     {
  15.        cout<<""<<endl;  
  16.     }   
  17.     system("pause");
  18.     return 0;
  19. }
複製代碼

TOP

  1. #include<iostream>

  2. using namespace std;

  3. int main()

  4. {

  5.       int score;               

  6.       cout<<"請輸入你的成績:";

  7.       cin>>score;

  8.       cout<<"你的成績是"<<score<<"分"<<endl;

  9.       if(score>=60)

  10.       {

  11.           cout<<"恭喜你及格了!"<<endl;

  12.       }else

  13.       {

  14.           cout<<"不及格!請再加油!"<<endl;                                      

  15.       }

  16.       

  17.                      

  18.       system("pause");

  19.       return 0;   

  20. }
複製代碼

TOP

返回列表