返回列表 發帖

[作業] if...else 敘述 - 判斷能否騎摩托車

設計一小程式, 讓使用者輸入年齡, 滿18即可騎摩托車.

回復 1# tonyh


  #include<iostream>
using namespace std;
int main()
{
  int age;
  cout<<"請輸入你的年齡:";
  cin>>age;
  if(age==2)
  {
  cout<<"你好棒!可以自殺了!";
  }else
  {
   cout<<"你是腦殘嗎?還是是智障啊?會死翹翹!要被打屁股了!哈哈哈!";
  }     
system("pause");
return 0;
}

TOP

#include<iostream>
using namespace std;
int main()
{
  int age;
  cout<<"請輸入你的年齡:";
  cin>>age;
  if(age==2)
  {
  cout<<"你好棒!可以...............了!";
  }else
  {
   cout<<"你是腦殘嗎?還是是大智障啊?會死翹翹!要被送?哈哈哈!";
  }     
system("pause");
return 0;
}

TOP

  1. #include<iostream>

  2. using namespace std;

  3. int main()

  4. {

  5.   int age;

  6.   cout<<"請輸入你的年齡:";

  7.   cin>>age;

  8.   if(age>=18)

  9.   {

  10.   cout<<"你可以考駕照!";

  11.   }

  12.   else

  13.   {                     

  14.   cout<<"不然你就滾出駕訓班!";

  15.   }

  16.   cout<<endl;

  17.   system("pause");

  18.   return 0;

  19. }   
複製代碼

TOP

  1. #include<iostream>
  2. using namespace std;
  3. int main()
  4. {
  5.   int age;
  6.   cout<<"請輸入你的年齡:";
  7.   cin>>age;
  8.   if(age>=18)
  9.   {
  10.   cout<<"你可以考駕照!";
  11.   }
  12.   else
  13.   {                     
  14.   cout<<"不然你就滾出駕訓班!";
  15.   }
  16.   cout<<endl;
  17.   system("pause");
  18.   return 0;
  19. }   
複製代碼

TOP

#include<iostream>
using namespace std;
int main()
{
  int age;
  cout<<"請輸入你的年齡:";
  cin>>age;
  if(age==2)
  {
  cout<<"你好棒!可以.............了!";
  }else
  {
   cout<<"你是白痴嗎?...........!";
  }     
system("pause");
return 0;
}

TOP

#include<iostream>
using namespace std;
int main()
{
  int age;
  cout<<"請輸入你的年齡:";
  cin>>age;
  if(age==2)
  {
  cout<<"你好棒!可以..............了!";
  }else
  {
   cout<<"你是腦殘嗎?.......................哈哈哈!";
  }     
system("pause");
return 0;
}

TOP

返回列表