返回列表 發帖

if...else 判斷式

本帖最後由 tonyh 於 2017-2-3 16:47 編輯

  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.         cout<<"恭喜你! 及格了!";
  11.     else
  12.         cout<<"不及格... 斬!";
  13.     cout<<endl;
  14.     system("pause");
  15.     return 0;   
  16. }
複製代碼

  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.    }
  13.    else
  14.    {
  15.     cout<<"不及格"<<endl;
  16.    }

  17.    
  18.    system("pause");
  19.    return 0;
  20. }
複製代碼

TOP

本帖最後由 柯識一 於 2017-2-3 16:11 編輯
  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,score<=100)
  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<<"Good job"<<endl;
  12. }else
  13. {  
  14.   cout<<"bad"<<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 age;
  7.     cout<<"說出你的年齡:";
  8.     cin>>age;
  9.     if(age>=45)
  10.     {
  11.                cout<<"恭喜你,你已經邁入更年期了";
  12.     }
  13.     else
  14.     {
  15.                 cout<<"滾吧!屁孩";
  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<<"恭喜你,及格了!";
  12.     }
  13.     else
  14.     {
  15.        cout<<"不及格,斬!!"<<endl;
  16.     }
  17.             
  18.     system("pause");
  19.     return 0;
  20. }
複製代碼

TOP

本帖最後由 tonyh 於 2017-2-4 13:51 編輯
  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<<"恭喜你,及格了!";
  12.               }
  13.               else
  14.    {
  15.               cout<<"不及格...斬!";
  16.               }
  17.               system("pause");
  18.               return 0;
  19. }
複製代碼

TOP

#include<iostream>     
#include<cstdlib>      
using namespace std;   
int main()   
{
    int score;
    cout<<"報上你的成績: ";
    cin>>score;
    if(score>=60)
    {
          cout<<"及格!"<<endl;
          }else
          {
          cout<<"不及格!"<<endl;
          }                 
    system("pause");      
    return 0;      
}

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<<"恭喜你,及格了!";
  12.               }
  13.               else
  14.    {
  15.               cout<<"不及格...斬!";
  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 age;
  7.    
  8.     cout<<"請輸入您的年齡: ";
  9.     cin>>age;
  10.    
  11.     if(age<12)
  12.     {
  13.          cout<<"您正處於歡樂童年"<<endl;
  14.     }
  15.     else if(age<30)
  16.     {
  17.          cout<<"您正處於花樣年華"<<endl;
  18.     }
  19.     else if(age<50)
  20.     {
  21.          cout<<"您正處於壯年時期"<<endl;
  22.     }
  23.     else if(age<65)
  24.     {
  25.          cout<<"您正處於更年期"<<endl;
  26.     }
  27.     else if(age<100)
  28.     {
  29.          cout<<"您是樂活銀髮"<<endl;
  30.     }
  31.     else if(age>100)
  32.     {
  33.          cout<<"您是一位人瑞啊!!!"<<endl;
  34.     }
  35.      system("pause");
  36.     return 0;
  37. }

  38.                
  39.    
  40.    
複製代碼

TOP

#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
    int score;
   
    cout<<"報你的成績:";
    cin>>score;
   
    if(score<60)
    {
         cout<<"再加油"<<endl;
    }
    else if(score>=60)
    {
         cout<<"再努力了";
    }   
   
    system("pause");
    return 0;
}

TOP

返回列表