- #include<iostream>
- #include<cstdlib>
- using namespace std;
- int main()
- {
- cout<<"☆★☆智能玩具店☆★☆"<<endl;
- string f[7]=
- {
- "(1)遙控汽車",
- "(2)飛機模型",
- "(3)足球 ",
- "(4)拼圖 ",
- "(5)玩具槍 ",
- "(6)可愛玩偶",
- "(7)籃球 "
- };
- int n[7]={450,550,325,200,660,150,380};
-
- for(int i=0;i<7;i++)
- {
- cout<<f[i]<<"\t"<<n[i]<<"元"<<endl;
- }
- int num=0;
- int count=0;
- int total=0;
- cout<<"輸入0結帳"<<endl;
- while(true)
- {
- cout<<"請輸入商品代碼"<<endl;
- cin>>num;
- if(num==0)
- {
- break;
- }
- cout<<"請輸入數量"<<endl;
- cin>>count;
- total=total+n[num-1]*count;
- }
- cout<<"總金額:"<<total<<endl;
- system("pause");
- return 0;
- }
複製代碼 |