返回列表 發帖
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {   
  6.     int sum=0;
  7.     int x,y;
  8.     string s[]={"珍珠奶茶","茉莉綠茶","泡沫紅茶","菊花茶","多多綠茶","梅子可樂","檸檬愛玉"};
  9.     int m[]={50,35,20,30,35,25,45};
  10.     cout<<"☆★☆清薪飲料店☆★☆"<<endl<<endl;
  11.     cout<<"[商品價目表]"<<endl;
  12.     for(int i=0;i<7;i++)
  13.     {
  14.             cout<<"("<<i+1<<")"<<s[i]<<"\t"<<m[i]<<"元"<<endl;
  15.     }
  16.     cout<<"(8)結帳"<<endl<<endl;
  17.     while(true)
  18.     {
  19.     cout<<"請輸入商品代碼: ";
  20.     cin>>x;
  21.     if(x==8)
  22.       break;
  23.     cout<<"數量: ";
  24.     cin>>y;
  25.     sum+=m[x-1]*y;                       
  26.     }
  27.     cout<<endl<<"共"<<sum<<"元!"<<endl;                        
  28.     system("pause");
  29.     return 0;   
  30. }
複製代碼

TOP

返回列表