返回列表 發帖

if...else if...else 判斷式

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     int score =0;
  7.     cout<<"請輸入你的成績:"<<endl;
  8.     cin >> score;
  9.     if(score >= 60 && score <=100) //&&同時成立 (and)   ||其中一14個成立就過 (or)
  10.     {
  11.       cout << "及格" << endl;   
  12.     }
  13.     else if(score >=0 && score <60)
  14.     {
  15.          cout << "不及格" << endl;
  16.     }
  17.     else
  18.     {
  19.       cout << "輸入錯誤" << endl;   
  20.     }
  21.    
  22.     system("pause");
  23.     return 0;
  24. }
複製代碼

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

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.    
  7.     int score=0;
  8.     cout<<"請輸入你成績:"<<endl;
  9.     cin>>score;
  10.     if(score>=60 && score<=100)
  11.     {
  12.        cout<<"及格"<<endl;   

  13.     }
  14.     else if(score>=0 && score<60)
  15.     {
  16.         cout<<"不及格"<<endl;
  17.     }   
  18.     else
  19.     {
  20.         cout<<"輸入錯誤"<<endl;
  21.     }
  22.     system("pause");
  23.     return 0;
  24. }
複製代碼

TOP

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

TOP

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

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.    int score=0;
  7.     cout<<"請輸入你的成績"<<endl;
  8.     cin>>score;
  9.     if(score>=60&&score<=100)
  10.     {
  11.     cout<<"及格"<<endl;
  12. }
  13. else if(score>=0&&score<60)
  14. {
  15.      
  16.     cout<<"不及格"<<endl;
  17. }
  18. else
  19.      {
  20.          cout <<"輸入錯誤"<<endl;
  21.    
  22. }                     
  23. system("pause");
  24. return 0;
複製代碼

TOP

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

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6. int score=0;
  7. cout<<"我的成績:"<<endl;
  8. cin>>score;
  9. if(score>=60&&score>=100)
  10. {
  11.     cout<<"及格"<<endl;
  12. }
  13.     else if(score>=0)
  14. {
  15.     cout<<"不及格"<<endl;
  16. }
  17.    else
  18. {
  19.     cout<<"輸入錯誤"<<endl;
  20. }  
  21.    system("pause");
  22.     return 0;
  23. }   
  24. 複製代碼
複製代碼

TOP

//W8QFR3uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuyyyyyyyB67TBV97ewqrvyetqUYVR3IQR73YRUIEW6TEW//TLJEWTBI HREUGIRBWT
//
//
//
//REATJKYEW8GHTB UREWTB
//EWTBOREWUTNOIBY4W RHGFCNW
//REW8OYV UIRYG98TRFVUIR
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
    int g=0;
    cout<<"請輸入你的成績:"<<endl;     cin >> g;

if(g>=60 &&g<=100)
{
         cout<<"及格了"<<endl;
         }
       else if(g>0 && g<60)
       {cout<<"白癡"<<endl;}
       else
       {cout<<"自障+ 腦禪 "<<endl;}
       system("pause");
       return 0;
       }
  1. //W8QFR3uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuyyyyyyyB67TBV97ewqrvyetqUYVR3IQR73YRUIEW6TEW//TLJEWTBI HREUGIRBWT
  2. //
  3. //
  4. //
  5. //REATJKYEW8GHTB UREWTB
  6. //EWTBOREWUTNOIBY4W RHGFCNW
  7. //REW8OYV UIRYG98TRFVUIR
  8. #include<iostream>
  9. #include<cstdlib>
  10. using namespace std;
  11. int main()
  12. {
  13.     int g=0;
  14.     cout<<"請輸入你的成績:"<<endl;     cin >> g;

  15. if(g>=60 &&g<=100)
  16. {
  17.          cout<<"及格了"<<endl;
  18.          }
  19.        else if(g>0 && g<60)
  20.        {cout<<"白癡"<<endl;}
  21.        else
  22.        {cout<<"自障+ 腦禪 "<<endl;}
  23.        system("pause");
  24.        return 0;
  25.        }
複製代碼

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     int score=10;
  7.     cout<<"報上成績來"<<endl;
  8.     cin>>score;
  9.     if(score>=60&&score<=100)
  10.     {
  11.     cout<<"你及格了"<<endl;
  12.     }
  13.     else if(score>=0&&score<60)
  14.     {
  15.     cout<<"可憐啊,人生難得有錯誤,加油吧"<<endl;
  16.     }
  17.     else
  18.     {
  19.     cout<<"恭喜你,你已經成為職業騙子了"<<endl;
  20.     }
  21.    
  22.     system("pause");
  23.     return 0;
  24. }
複製代碼

TOP

返回列表