- #include<iostream>
- #include<cstdlib>
- using namespace std;
- int main()
- {
- int age;
- re:
- cout<<"請輸入你的年齡:";
- cin>>age;
- if(age<4 && age>=1 )
- 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<=120)
- cout<<"購買敬老票(70)元!"<<endl;
- else
- cout<<"別鬧了"<<endl;
- goto re;
- system("pause");
- return 0;
- }
複製代碼 |