- #include<iostream>
- #include<cstdlib>
- using namespace std;
- int main()
- {
- int z,f,sum=0;
-
- string x[]={"菠蘿麵包 ","小餐包(六入) ","巧克力熱壓吐司","紅豆麵包 ","桂圓麵包 ","培根玉米三明治","北歐圓法(四入)"};
- int y[]={35,50,45,30,55,65,45};
- cout<<"左營可口麵包店"<<endl<<endl;
- cout<<"{麵包價目表]"<<endl;
-
- for(int i=0;i<7;i++)
- {
- cout<<"("<<i+1<<")"<<x[i]<<"\t"<<y[i]<<"元"<<endl;
- }
- cout<<"(8)結帳"<<endl<<endl;
- while(true)
- {
- cout<<"請輸入商品代碼: ";
- cin>>z;
- if(z==8)
- break;
- cout<<"數量: ";
- cin>>f;
- sum+=y[z-1]*f;
- }
- cout<<endl<<"共"<<sum<<"元!"<<endl;
- system("pause");
- return 0;
- }
複製代碼 |