freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

商品銷售統(tǒng)計--c課程設(shè)計(已修改)

2025-08-04 17:50 本頁面
 

【正文】 18 商品銷售統(tǒng)計 問題描述 編寫商品銷售統(tǒng)計程序,商品的信息有商品名、計量單位(重量或件)、單價。所有商品的信息事先已存入計算機,屏幕上顯示所有商品的名稱,選擇商品名,輸入商品計量單位(如重量、件數(shù)等),根據(jù)單價算出總價。客戶一次可能購買多種商品,程序應(yīng)計算出客戶應(yīng)付的錢款數(shù)。 基本要求 程序分為兩個部分:第一部分用亍輸入商品的信息并允許修改和刪除;第二部分實現(xiàn)銷售統(tǒng)計。程序運行時由用戶選擇進入哪一部分功能,并能在運行時在兩部分之間切換。第二部分運行時,首先顯示所有商品名稱 及代碼(商品數(shù)目較多時,應(yīng)考慮分屏顯示),用戶輸入商品代碼及商品重量或件數(shù),用戶一次操作可輸入若干商品的購買信息,然后輸入一個特殊的代碼(如“ 1”)表示本次購物結(jié)束。此時,程序計算出應(yīng)付錢款數(shù)并顯示。 文字描述 先定義一個商品類 GOODS,含有每種商品基本信息即商品名、計量單位(重量或件)、單價、商品總量皆被定義為私有數(shù)據(jù)成員;公有成員部分有該類構(gòu)造函數(shù)以及其他友元函數(shù)。 為了完成程序基本要求,采用嵌套系統(tǒng)思想,即先構(gòu)造一個總的系統(tǒng) ——商品銷售統(tǒng)計工程,通過 switch 語句可選擇進入其下 面兩個子系統(tǒng) ——商品信息管理系統(tǒng)和商品銷售系統(tǒng),以完成程序要求的兩個部分的功能。其中,每個子系統(tǒng)又可根據(jù) switch 語句進行選擇操作,并能實現(xiàn)在兩個子系統(tǒng)之間的切換。 19 圖示 類名 類別 類型 名稱 說明private string name 商品名private string unit 計量單位private double price_per_unit 單價private double amount 商品總數(shù)public GOODS () 構(gòu)造函數(shù)GOODSfriend viod sort() 排序 , 使得信息為空的商品沉底friend viod input_gds_mesg() 底層函數(shù) : 錄入商品信息friend viod Message_modify() 底層函數(shù) : 修改商品信息friend viod Message_delete() 底層函數(shù) : 刪除商品信息friend viod Goods_Message_Manage() 中層函數(shù) : 1. 商品信息管理系統(tǒng)friend viod Goods_Sale() 中層函數(shù) : 2. 商品銷售系統(tǒng)friend viod WORK() 高層函數(shù) : 商品銷售統(tǒng)計工程 根據(jù)提示選擇操作即可,具體為: ( 1) 程序運行時,首先要求初始化商品信息,即需添加銷售的商品名稱、單價等; ( 2) 根據(jù)需求選擇進入商品信息管理系統(tǒng)或者商品銷售系統(tǒng),其中前者可進行的操作有:錄入新商品信息、修改商品信息、刪除商品信息等,后者為用 戶提供購買商品功能,只需根據(jù)提示操作即可; 注意:請輸入不程序要求相應(yīng)的選擇以及正確的格式,丌要超出程序給定的范圍! 源代碼 includeiostream includestring includefstream using namespace std。 int choice。 class GOODS { 20 private: string name。 //商品名 string unit。 //計量單位 double price_per_unit。 //單價 double amount。 //商品總數(shù) public: GOODS()。 //構(gòu)造函數(shù) //排序函數(shù),使得信息為空的商品類數(shù)組元素沉底,丌為空的排在前面(被 刪除商品信息函數(shù) 調(diào)用) friend void sort(GOODS array[],int size)。 friend void input_gds_mesg(GOODS goods1[],int size)。 //底層函數(shù):錄入商品信息 (從屬亍商品信息管理系統(tǒng) ) friend void Message_modify(GOODS goods2[],int size)。 //底層函數(shù):修改商品信息(從屬亍商品信息管理系統(tǒng)) friend void Message_delete(GOODS goods3[],int size)。 //底層函數(shù):刪除商品信息(從屬亍商品信息管理系統(tǒng)) friend void Goods_Message_Manage(GOODS Goods1[],int size)。 //中層函數(shù): (從屬亍商品銷售統(tǒng)計工程) friend void Goods_Sale(GOODS Goods2[],int size)。 //中層函數(shù):(從屬亍商品銷售統(tǒng)計工程) friend void WORK(GOODS Goods[],int size)。 //高層函數(shù):商品銷售統(tǒng)計工程 }。 GOODS::GOODS() { name=0。 unit=0。 price_per_unit=。 amount=0。 } 21 void input_gds_mesg(GOODS goods1[],int size) //底層 函數(shù):錄入商品信息函數(shù) (從屬亍商品信息管理系統(tǒng) ) { int i,j,m=0。 int s=size。 int n=size。 string l。 for(i=0。is。i++) { if(goods1[i].name!=0)m++。 else if(goods1[i].name==0)s=m。 } for(j=m。jn。j++) { cout ________________________________________________________________________ endl。 cout請輸入第 j+1種商品的名稱: __。 cingoods1[j].name。 coutendl。 cout請輸入第 j+1種商品的計量單位: __。 cingoods1[j].unit。 coutendl。 cout請輸入第 j+1種商品的單價(元): __。 cingoods1[j].price_per_unit。 coutendl。 cout請輸入第 j+1種商品的數(shù)量: __。 cingoods1[j].amount。 cout ________________________________________________________________________ endl。 coutendl。 22 cout__繼續(xù)錄入商品信息?( y/n) __。 cinl。 coutendl。 if(l==n||l==N)n=j。 else if(l==y||l==Y){}。 } cout__商品信息錄入完成! endlendl。 cout ________________________________________________________________________ endl。 return。 } void Message_modify(GOODS goods2[],int size) //底層函數(shù) :修改商品信息函數(shù)(從屬亍商品信息管理系統(tǒng)) { if(goods2[0].name==0) { coutCaution:當(dāng)前無商品信息,請返回更新!( y/n) __。 string c。 cinc。 cout ________________________________________________________________________ endl。 coutendl。 if(c==y||c==Y) { Goods_Message_Manage(goods2,size)。 WORK(goods2,size)。 } else { cout 謝謝使用, 23 祝您愉快!再見! endl。 exit(0)。 } } string p,q。 int n。 string unit。 string name。 double price。 double amount。 int choice2。 do { do { cout 商品信息列表 endlendl。 cout\t 商品編號 \t 商品名稱 \t 商品單價 \t 商品余量endlendl。 int i,m=0。 int s=size。 for(i=0。is。i++) { if(goods2[i].name!=0)m++。 else if(goods2[i].name==0)s=m。 } for(i=0。im。i++) { cout\ti+1.\t\tgoods2[i].name\tgoods2[i].price_per_unit 元/goods2[i].unit\tgoods2[i].amountgoods2[i].unitendlendl。 24 } cout ________________________________________________________________________ endl。 cout請輸入您想修改信息的商品編號: __。 // int n。 cinn。 cout ________________________________________________________________________ endl。 coutendl。 cout__ 您 想 修 改 信 息 的 商 品 為 :n.goods2[n1].name( y/n) __。 // string p。 cinp。 coutendl。 if(p==y||p==Y) { cout ________________________________________________________________________ endl。 do { cout endlendl。 cout endlendl。 cout(元) endlendl。 cout endlendl。 cout ________________________________________________________________________ endl。 cout請輸入您的選擇( 14): __。 cinchoice2。 coutendl。 switch(choice2) 25 { case 1: cout 請輸入 n 號商品goods2[n1].name的名稱: __。 // !! string name。 cinname。 goods2[n1].name=name。 break。 case 2: cout 請輸入 n 號商品goods2[n1].name的計量單位: __。 // !! string unit。 cinunit。 goods2[n1].unit=unit。 break。 case 3: cout 請輸入 n 號商品goods2[n1].name的單價: __。 // !! double price。 cinprice。 goods2[
點擊復(fù)制文檔內(nèi)容
研究報告相關(guān)推薦
文庫吧 www.dybbs8.com
公安備案圖鄂ICP備17016276號-1