返回列表 發帖
  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>3&&age<=12)
  13.                 cout<<"請購買兒童票(50元)"<<endl;
  14.         else if(age>12&&age<=64)
  15.                 cout<<"請購買一般票(100元)"<<endl;
  16.         else if(age>64&&age<=100)
  17.                 cout<<"請購買敬老票(70元)"<<endl;
  18.         else
  19.                 cout<<"別鬧了!"<<endl;
  20.         goto re;       
  21.         system("pause");
  22.         return 0;
  23. }
複製代碼

TOP

返回列表