返回列表 發帖
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     int sum=0;
  7.     int code,qty;
  8.     string name[]={"齊爾 爆焰龍捲","卡莉 聖域福音","悟空 合金進化","夜叉 戰地之王","瑟斐斯 煉獄修羅","柯里納卡 荒漠邪翅","馬洛斯 鋼鐵戰線"};
  9.     int price[]={450,550,325,200,660,150,150,380};
  10.     cout<<"☆★☆傳說對決造型專賣店☆★☆"<<endl<<endl;
  11.     cout<<"[商品價目表]"<<endl;
  12.     for(int i=0;i<7;i++)
  13.     {
  14.     cout<<"("<<i+1<<")"<<name[i]<<"\t"<<price[i]<<"元"<<endl;
  15.     }
  16.     cout<<"(8)結帳"<<endl<<endl;
  17.     while(true)
  18.     {
  19.         cout<<"請輸入商品代碼:";
  20.         cin>>code;
  21.         if(code==8)
  22.         break;
  23.         cout<<"數量:";
  24.         cin>>qty;
  25.         sum+=price[code-1]*qty;               
  26.     }
  27.     cout<<endl<<"總共"<<sum<<"元"<<endl;
  28.      
  29.     system("pause");
  30.     return 0;
  31. }
複製代碼

TOP

返回列表