Board logo

標題: if...else if...else 判斷式 [打印本頁]

作者: 歐柏罕    時間: 2017-10-16 19:45     標題: 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. }
複製代碼

作者: 曾堂桂    時間: 2017-10-16 19:48

  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. }
複製代碼

作者: 沈子晏    時間: 2017-10-16 19:48

  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. }
複製代碼

作者: 彭煥宇    時間: 2017-10-16 19:49

  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. }
複製代碼

作者: 盧佑芯    時間: 2017-10-16 19:51

  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. }
複製代碼

作者: 洪翊庭    時間: 2017-10-16 20:05

  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;
複製代碼

作者: 盧佑恩    時間: 2017-10-16 20:09

  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. }
複製代碼

作者: 洪翊展    時間: 2017-10-16 20:11

  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. 複製代碼
複製代碼

作者: 洪啓銓    時間: 2017-10-16 20:16

//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.        }
複製代碼

作者: 李治毅    時間: 2017-10-16 20:16

  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. }
複製代碼





歡迎光臨 種子論壇 | 高雄市資訊培育協會學員討論區 (http://istak.org.tw/seed/) Powered by Discuz! 7.2