c课程设计商品销售管理系统内容摘要:

{ int id。 char name[50]。 //字符数组 int count。 float iprice。 float oprice。 char gys[20]。 if(n0) n=0。 int i。 Data temp。 for(。 n++) { cout商品编号 :。 cinid。 if(id==1) break。 t[n].setId(id)。 cout商品名 :。 cinname。 t[n].setName(name)。 cout库存量 :。 cincount。 t[n].setCount(count)。 cout进价 :。 — 5— ciniprice。 t[n].setBuy(iprice)。 cout售价 :。 cinoprice。 t[n].setSale(oprice)。 cout供应商 :。 cingys。 t[n].setGys(gys)。 t[n].setSaleCount(0)。 //售出此产品 0 个 cout若商品添加完毕,请按 1 退出添加 !endl。 for(i=0。 in。 i++) { if(t[i].getId()t[n].getId()) { temp=t[i]。 t[i]=t[n]。 t[n]=temp。 } } } } void showData(int i) { coutt[i].getId() setw(10)t[i].getName() setw(10)t[i].getCount() setw(10)t[i].getSaleCount() — 6— setw(8)t[i].getBuy() setw(8)t[i].getSale() setw(8)t[i].getGys()endl。 } void showData() { cout商品编号 setw(8)商品名 setw(8)库存量 setw(10)已售量 setw(10)进价 setw(8)售价 — 6— setw(8)供应商 endl。 for(int i=0。 in。 i++) if(t[i].getCount()0 ) showData(i)。 cout产品种类 :nendl。 } void save() //写入数据至文件 { ofstream fout。 (商品销售管理系统 .txt)。 if(!fout) { coutcannot open the file!endl。 return。 } fout商品编号 商品名 库存量 进价 售价 供应商 已售量 endl。 for(int i=0。 in。 i++) { foutt[i].getId()setw(14)t[i].getName()setw(10)t[i].getCount()setw(10)t[i].getBuy()setw(10)t[i].getSale()setw(10)t[i].getGys()setw(10)t[i].getS。
阅读剩余 0%
本站所有文章资讯、展示的图片素材等内容均为注册用户上传(部分报媒/平媒内容转载自网络合作媒体),仅供学习参考。 用户通过本站上传、发布的任何内容的知识产权归属用户或原始著作权人所有。如有侵犯您的版权,请联系我们反馈本站将在三个工作日内改正。