- #include<iostream>
- #include<cstdlib>
- using namespace std;
- int main()
- {
- int age;
- re:
- cout<<"請輸入年齡:";
- cin>>age;
- if(age<=3 && age>=0)
-
- cout<<"幼兒票:免費入場"<<endl;
-
- else if(age<=12 && age>=4)
-
- cout<<"兒童票:50元"<<endl;
-
- else if(age<=64 && age>=13)
-
- cout<<"一般票:100元"<<endl;
-
- else if(age>=65 && age<=105)
-
- cout<<"敬老票:70元"<<endl;
-
- else
-
- cout<<"請輸入正確年齡"<<endl;
- goto re;
-
- system("pause");
- return 0;
-
- }
複製代碼 |