返回列表 發帖
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     int price[]={10000,5000,50000,4444,10,1744,55,10000};
  7.     int h, q, sum=0;
  8.     cout<<"以諾豪華九星級飯店"<<endl;
  9.     cout<<"[飯店房間價目表]"<<endl;
  10.     cout<<"(1)四人套房\t10000元"<<endl;
  11.     cout<<"(2)兩人套房\t5000元"<<endl;
  12.     cout<<"(3)七人小木屋\t50000元"<<endl;
  13.     cout<<"(4)孤單一人房\t4444元"<<endl;
  14.     cout<<"(5)百人總統房\t10元"<<endl;
  15.     cout<<"(6)安靈病房\t1744元"<<endl;
  16.     cout<<"(7)太平間地下房\t55元"<<endl;
  17.     cout<<"(8)跟泳鱔一夜情套房\t1元"<<endl;
  18.     cout<<"[付費說明]"<<endl;
  19.     cout<<"把要住的房間代號輸入後,再輸入要買幾間,如要買百人總統套房三間:5 3"<<endl;
  20.     cout<<"購買完請輸入9 9前往結帳"<<endl;
  21.     start:
  22.     cin>> h >> q;
  23.     if(h>=1 && h<=8 && q>0)
  24.     {
  25.             sum=sum+price[h-1]*9;
  26.             goto start;
  27.             }
  28.     else if(h==9 && q==9)
  29.     {
  30.             goto checkout;
  31.          }        
  32.     else
  33.     {
  34.             cout<<"輸入錯誤!!"<<endl;
  35.             goto start;
  36.         }     
  37.     checkout:
  38.     cout<<endl<<"總共"<<sum<<"元!"<<endl;            
  39.     system("pause");
  40.     return 0;
  41.     }
複製代碼

TOP

返回列表