- #include<iostream>
- #include<cstdlib>
- using namespace std;
- int main()
- {
- int price[]={10000,5000,50000,4444,10,1744,55,10000};
- int h, q, sum=0;
- cout<<"以諾豪華九星級飯店"<<endl;
- cout<<"[飯店房間價目表]"<<endl;
- cout<<"(1)四人套房\t10000元"<<endl;
- cout<<"(2)兩人套房\t5000元"<<endl;
- cout<<"(3)七人小木屋\t50000元"<<endl;
- cout<<"(4)孤單一人房\t4444元"<<endl;
- cout<<"(5)百人總統房\t10元"<<endl;
- cout<<"(6)安靈病房\t1744元"<<endl;
- cout<<"(7)太平間地下房\t55元"<<endl;
- cout<<"(8)跟泳鱔一夜情套房\t1元"<<endl;
- cout<<"[付費說明]"<<endl;
- cout<<"把要住的房間代號輸入後,再輸入要買幾間,如要買百人總統套房三間:5 3"<<endl;
- cout<<"購買完請輸入9 9前往結帳"<<endl;
- start:
- cin>> h >> q;
- if(h>=1 && h<=8 && q>0)
- {
- sum=sum+price[h-1]*9;
- goto start;
- }
- else if(h==9 && q==9)
- {
- goto checkout;
- }
- else
- {
- cout<<"輸入錯誤!!"<<endl;
- goto start;
- }
- checkout:
- cout<<endl<<"總共"<<sum<<"元!"<<endl;
- system("pause");
- return 0;
- }
複製代碼 |