返回列表 發帖
本帖最後由 尤爾呈 於 2019-8-12 20:45 編輯

#include<iostream>
#include<cstdlib>
using namespace std;

int main()
{
    re:
    int age;
       cout<<"請輸入你的年齡"<<endl;
    else if (age>=0&&age>=3)
       cout<<"幼兒票免費入場"<<endl;
    else if (age>=4&&age>=12)
       cout<<"兒童票50元入場"<<endl;
    else if (age>=13&&age>=64)
       cout<<"一般票100元入場"<<endl;
    else if (age>=65&&age>=100)
       cout<<"敬老票70元入場"<<endl;
    else
       cout<<"別鬧了!!!"<<endl;  
         
          goto re;        
        system("pause");
        return 0;
}

TOP

  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;

  4. int main()
  5. {
  6.     re:
  7.     int age;
  8.        cout<<"請輸入你的年齡"<<endl;
  9.        cin>>age;
  10.      if (age>=0&&age<=3)
  11.        cout<<"幼兒票免費入場"<<endl;
  12.     else if (age>=4&&age<=12)
  13.        cout<<"兒童票50元入場"<<endl;
  14.     else if (age>=13&&age<=64)
  15.        cout<<"一般票100元入場"<<endl;
  16.     else if (age>=65&&age<=100)
  17.        cout<<"敬老票70元入場"<<endl;
  18.     else
  19.        cout<<"別鬧了!!!"<<endl;  
  20.          
  21.           goto re;        
  22.         system("pause");
  23.         return 0;
  24. }
複製代碼

TOP

返回列表