- #include<iostream>
- using namespace std;
- int main ()
- {
- cout<<"☆★☆《影武的網路速食店》☆★☆"<<endl;
- cout<<endl;
- cout<<"〔商品價目表〕"<<endl;
- string list[8]={"薯條","漢堡","可樂","雪碧","奶昔","紅茶","披薩","結帳"};
- int money[7]={50,80,45,45,55,45,299};
- for ( int i=0 ; i<8 ; i++)
- {
- cout<<"("<<i+1<<")"<<list[i]<<""<<"\t";
- if (i!=7){
- cout<<money[i]<<"元"<<endl;
- }
-
- }
- cout<<endl;
- int sum=0;
- while (true)
- {
- int a=0,b=0;
- cout<<"請輸入代碼"<<endl;
- cin>>a;
- if(a==8){
- break;
- }else{
- cout<<"數量"<<endl;
- cin>>b;
- sum += money[a-1]*b;
- }
- }
- cout<<"收您"<<sum<<"元"<<endl;
- system("pause");
- return 0;
- }
複製代碼 |