返回列表 發帖
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main(){
  5.     int num=0,lab,q;
  6.     string tag[9]={"俠盜列車手5    ","決勝時刻:黑色行動3","虹彩六號:圍突行動 ",
  7.                    "minecraft    ","星際大戰:戰場前線 ","正當防衛3     ",
  8.                    "湯姆克蘭西:末日邊界","潛龍諜影:幻痛   "};
  9.     int price[8]={2250,2250,1790,990,2500,1900,1500,2200};
  10.     cout<<"\t※※※子耕電玩專賣店※※※"<<endl<<"本店商品保證便宜^_^"<<endl<<endl;
  11.     cout<<"[商品一覽表]"<<endl;
  12.     for(int i=0; i<8; i++){
  13.        cout<<"<"<<i+1<<">"<<tag[i]<<"\t\t"<<price[i]<<"元"<<endl;   
  14.     }
  15.     cout<<"<9>結帳去"<<"\t\t"<<endl<<endl;
  16.     cout<<"[優惠方案]\t本店滿5000元及立刻打九折"<<endl<<endl;
  17.    
  18.    
  19.    
  20.    
  21.     A:
  22.     cout<<"請輸入商品代碼: ";
  23.     cin>>lab;
  24.     if(lab==9)
  25.       goto B;
  26.     cout<<"數量: ";
  27.     cin>>q;
  28.     num+=price[lab-1]*q;
  29.     goto A;
  30.    
  31.     B:
  32.     cout<<"共"<<num<<"元"<<endl;;                     
  33.     system("pause");   
  34.     return 0;
  35. }
複製代碼
ABCDEFGHIJKLMNOPQRSTUVWXYZ

TOP

返回列表