Board logo

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

作者: 陳品肇    時間: 2019-3-30 10:04     標題: 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.    }
  13.    else
  14.    {
  15.          cout<<"不及格!打屁股!"<<endl;
  16.    }   
  17.     system("pause");
  18.     return 0;   
  19. }
複製代碼

作者: 洪子涵    時間: 2019-3-30 10:34

  1. #include<cstdlib>
  2. #include<iostream>
  3. using namespace std;
  4. int main()
  5. {
  6.    int g;
  7.    cout<<"請輸入成績=";
  8.    cin>>g;
  9.    if(g>=60) cout<<"及格"<<endl;
  10.    else cout<<"不及格 "<<endl;
  11.    system("pause");
  12.    return 0 ;
  13.    
  14.    
  15. }
複製代碼

作者: 邱楷宸    時間: 2019-3-30 10:35

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {   
  6.     int s; //變數名稱與要做的事有一定程度的相關
  7.     cout<<"請輸入你的成績: ";
  8.     cin>>s;
  9.      cout<<"分"<<endl;
  10.    
  11.    
  12.     if(score>=60)
  13.    {
  14.         cout<<"恭喜你及格了>_<!"<<endl;
  15.    }
  16.    else
  17.    {
  18.          cout<<"不及格x_x!"<<endl;
  19.    }   
  20.     system("pause");
  21.     return 0;   
  22. }
複製代碼

作者: 李易展    時間: 2019-3-30 10:35

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     int a;
  7. cout<<"請輸入成績:";
  8. cin>>a;
  9. if(a>=60)
  10. {cout<<"成績及格!!"<<endl;}
  11. else
  12. {cout<<"成績不及格!!"<<endl;}
  13.    system("pause");
  14.     return 0;   
  15. }
複製代碼

作者: 洪藜芸    時間: 2019-3-30 10:40

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     int x,;
  7.     cout<<"請告訴我你的成績>>";
  8.     cin>>x;
  9.     if(x >= 60)
  10.     {
  11.          cout<<"及格誒!!!"<<endl;
  12.     }
  13.     else
  14.     {
  15.          cout<<"竟然不及格..."<<endl;
  16.     }
  17.    
  18.     system("pause");
  19.     return 0;
  20. }
複製代碼

作者: 黃傳耀    時間: 2019-3-30 10:42

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

作者: 謝蓮金    時間: 2019-3-30 11:05

  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.     system("pause");
  18.     return 0;   
  19. }
複製代碼

作者: 王建葦    時間: 2019-4-3 20:28

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

作者: 陳宇柏    時間: 2019-5-22 14:34

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.   float 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. }
複製代碼





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