返回列表 發帖

【3-1】if...else 判斷式

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.    int score;
  7.    cout<<"報上你的成績: ";
  8.    cin>>score;
  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. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     int score;
  7.     cout<<"報上你的成績: ";
  8.     cin>>score;
  9.     if(score>=60)
  10.     {
  11.                  cout<<"恭喜你!及格了!"<<endl;
  12.     }else
  13.     {
  14.          cout<<"不及格~斬!"<<endl;
  15.     }
  16.     system("pause");
  17.     return 0;
  18. }
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.    int score;
  7.    cout<<"報上你的成績: ";
  8.    cin>>score;
  9.    if(score>=60)
  10.    {
  11.         cout<<"及格了"<<endl;
  12.    }else
  13.    {
  14.         cout<<"不及格~ 斬!"<<endl;
  15.    }
  16.    system("pause");
  17.    return 0;
  18. }
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     int grade;
  7.     cout<<"報上你的成績:";
  8.     cin>>grade;
  9.     if(grade>=60)
  10.     {
  11.        cout<<"及格了,666"<<endl;        
  12.     }else
  13.     {
  14.          cout<<"不及格,下去"<<endl;
  15.     }
  16.      system("pause");
  17.      return 0;   
  18. }
複製代碼

TOP

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

TOP

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

TOP

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

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.       int score;
  7.       cout<<"報上你的成績: ";
  8.       cin>>score;
  9.       if(score>=60)
  10.       {
  11.            cout<<"恭喜你!及格了!好棒棒!"<<endl;
  12.       }else
  13.       {      
  14.            cout<<"不及格~去吃屎!"<<endl;
  15.       }
  16.       system("pause");
  17.       return 0;
  18. }
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     int score;
  7.     cout<<"報上你的成績:";
  8.     cin>>
  9.     score;
  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. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     int score;
  7.     cout<<"報上你的成績:";
  8.     cin>>score;
  9.     if(score>=60)
  10.     {
  11.          cout<<"恭喜你! 及格了!"<<endl;
  12.     }else
  13.     {
  14.          cout<<"不及格~ 斬!"<<endl;
  15.     }
  16.     system("pause");
  17.     return 0;
  18. }
複製代碼

TOP

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

TOP

本帖最後由 1090121_1 於 2020-2-7 09:49 編輯
  1. #include <iostream>
  2. #include <cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.         int score;
  7.         cout << "請輸入你的成績:"<<endl;
  8.         cin >> score;
  9.         if(score>100)
  10.         {
  11.                 cout << "你作弊!"<<endl;
  12.         }
  13.         if(score==100)
  14.         {
  15.                 cout << "好厲害! 能考100分!"<<endl;
  16.         }
  17.         else if(score>90)
  18.         {
  19.                 cout << "恭喜!考"<<score<<"分!"<<endl;       
  20.         }
  21.         else if(score>80)
  22.         {
  23.                 cout << "不錯!有80分以上"<<endl;       
  24.         }
  25.         else if(score>70)
  26.         {
  27.                 cout << "加油!只有七十幾分!"<<endl;       
  28.         }
  29.         else
  30.         {
  31.                 cout << "好吧...不到70,請再加油!!"<<endl;       
  32.         }
  33.         system("pause");
  34.         return 0;
  35. }
複製代碼

TOP

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

TOP

返回列表