返回列表 發帖
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     int thing, number,sum=0;
  7.     string name[21]={"V家七宗罪系列(包含序號2~9)",
  8.                      "湯匙(齒輪)                ",
  9.                      "酒杯                      ",
  10.                      "劍                        ",
  11.                      "金鑰匙                    ",
  12.                      "人偶                      ",
  13.                      "四面鏡                    ",
  14.                      "禍世之剪                  ",
  15.                      "上了發條的搖籃曲          ",
  16.                      "白癡藥水                  ",
  17.                      "生鏽的齒輪人偶            ",
  18.                      "受詛咒之雙刃(附皮革套)    ",
  19.                      "跳針的古老大鐘            ",
  20.                      "失憶藥丸                  ",
  21.                      "座敷童子的靈棺            ",
  22.                      "淌血的附喪神人偶          ",
  23.                      "會咬人的蜘蛛玩偶          ",
  24.                      "梅杜莎的頭顱              ",
  25.                      "巫婆熬藥的大鍋            ",
  26.                      "活生生殭屍殺人魔/吸血鬼   "};
  27.     long money[21]={1200,70,80,80,100,120,150,100,350,
  28.                     70,80,20,1300,130,700,130,120,500,1000,10000};
  29.     int qty[21]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
  30.     cout<<"XXX崩壞/中二玩具精品店XXX"<<endl;
  31.     cout<<"這裡的壞掉商品包山包海,應有盡有,等你來搜刮!"<<endl;
  32.     cout<<"本店絕對沒有惡意哄抬價格,也絕對沒有低價購入,高價賣出的不良嗜好,敬請安心"<<endl;
  33.     cout<<"對於購買商品的問題,出事本店一概不負責"<<endl;
  34.     cout<<"--------------------------------------------------------------------------"<<endl;
  35.     int i=0;
  36.     while(i<20)
  37.     {
  38.         cout<<"("<<i+1<<")"<<name[i]<<"\t"<<money[i]<<"萬元"<<endl;   
  39.         i++;
  40.     }
  41.     cout<<"(21)結帳"<<endl;
  42.     re:
  43.     cout<<"請輸入商品代號: "<<endl;
  44.     cin>>thing;
  45.     if(thing==21)
  46.     {
  47.         goto checkout;            
  48.     }
  49.     else if(thing>0 && thing<21)
  50.     {
  51.         cout<<"數量: "<<endl;
  52.         cin>>number;
  53.         if(number<=0)
  54.         {
  55.             cout<<"奧客去死辣!本店將會詛咒你的餘生(甩門)"<<endl;
  56.             goto re;        
  57.         }
  58.         sum+=money[thing-1]*number;
  59.         qty[thing-1]+=number;
  60.     }
  61.     else
  62.     {
  63.         cout<<"奧客去死辣!本店將會詛咒你的餘生(甩門)"<<endl;   
  64.     }
  65.     goto re;
  66.     checkout:
  67.     cout<<endl<<"中二精品購物清單"<<"\a"<<endl;
  68.     cout<<"------------------------------"<<"\n";
  69.     for(int i=0;i<21;i++)
  70.     {
  71.         if(qty[i]!=0)
  72.         {
  73.             cout<<name[i]<<"\t"<<money[i]<<"元 * "<<qty[i]<<"個"<<endl;           
  74.         }   
  75.     }
  76.     cout<<"------------------------------"<<"\n";
  77.     cout<<"共"<<sum<<"萬元"<<endl;
  78.     system("pause");
  79.     return 0;   
  80. }
複製代碼

TOP

返回列表