本帖最後由 許婷芳 於 2019-8-23 15:09 編輯
- #include<iostream>
- #include<cstdlib>
- using namespace std;
- int main()
- {
- int season;
- re:
- cout<<"請輸入季節(1.春 2.夏 3.秋 4.冬): ";
- cin>>season;
- switch(season)
- {
- case 1:
- cout<<" 春 spring"<<endl;
- break;
- case 2:
- cout<<" 夏 summer"<<endl;
- break;
- case 3:
- cout<<" 秋 fall"<<endl;
- break;
- case 4:
- cout<<" 冬 winter"<<endl;
- break;
- default:
- cout<<"輸入錯誤"<<endl;
- }
- goto re;
- system("pause");
- return 0;
- }
複製代碼 |