返回列表 發帖

if...else 判斷式

  1. //if...else 判斷式    單行註解
  2. #include<iostream>
  3. #include<cstdlib>
  4. using namespace std;
  5. int main()
  6. {
  7.     int score;
  8.     cout<<"請輸入你的分數: ";
  9.     cin>>score;
  10.     if(score>=60)
  11.     {
  12.         cout<<"恭喜你!及格了!"<<endl;
  13.     }else
  14.     {
  15.         cout<<"不及格!斬!"<<endl;
  16.     }
  17.     system("pause");  //系統("暫停")
  18.     return 0;
  19. }

  20. /*  多行註解

  21.    if( 肚子餓 )
  22.    {
  23.        去吃飯
  24.    }else
  25.    {
  26.        繼續打電動     
  27.    }
  28.    
  29. */
複製代碼

返回列表