ImageVerifierCode 换一换
格式:DOCX , 页数:43 ,大小:22.18KB ,
资源ID:24000235      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/24000235.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(物品库存管理源代码.docx)为本站会员(b****8)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

物品库存管理源代码.docx

1、物品库存管理源代码/*物品库存管理*/ /file operations #include #include #include #include #include #include #include #include #include /exit(1) #define MAXNUM 10 /运用宏定义,规定品牌数最大为10 time_t timer; inline istream & Flush(istream & stream) /清空缓冲区的函数。可以解决过多输入 stream.clear(); int chars_to_skip=stream.rdbuf()-in_avail(); re

2、turn stream.ignore(chars_to_skip); class Brand /品牌类 private: char brnd_name20; /品牌名称 int Brand_code; /品牌代号 int quantity; /数量 float brnd_price; /价格 public: Brand()quantity=0;strcpy(brnd_name, friend class CItem; /定义友元类 friend class CNode; friend class CList; ; class CItem /品种类 private: char Item_name

3、10; /品种名称 int Item_code; /品种代号 char colour10; /颜色 int quantity; /数量 个品牌MAXNUM最多/ Brand brndMAXNUM; int nBrnd; /品牌的数量(Show(); /输出结点中的数据 CItem * GetData() return pData;/返回下一结点的指针 friend class CList; /定义链表类为友元类 ; class CList /定义链表类 protected: CNode * pHead; /链表头结点指针 public: CList() pHead=0; CList() Del

4、eteList(); void AddNode(CNode * pnode); /首部添加结点 CNode * DeleteNode(CNode *); /删除一个指定的结点,返回该结点的指针 CNode * LookUp(CItem &); /*查找一个指定的数据,返回该数据所在结点在链表中的指针,若未找 到返回0 */ void ShowList(); /打印整个链表 void DeleteList(); /删除整个链表 CNode * GetListHead()return pHead; /返回链表首结点 CNode * GetListNextNode(CNode *); /返回链表指定

5、结点的下一个结点 void Insert(CNode *); /按代码的顺序插入一个结点 ; class customer /仿品牌类增加客户类 private: char customer_name10;/客户姓名 int customer_code;/客户代码 char customer_tel15;/客户电话 char customer_Item_name10;/客户选择的品种名称 char customer_brnd_name20;/客户选择的品牌名称 void getdata(); void showdata(); public: void add();/新增 void remove

6、();/移除 void search();/搜索 void showab();/显示 friend class CItem; /定义友元类 friend class Brand; ; int CItem:Compare(CItem & pitem) /比较品种名称,供查找用,比较结果为1,0 int n; n=strcmp(Item_name,pitem.Item_name);/两个字符串相等,n=0 if(n!=0) return 0; else return 1; int CItem:CompareCode(CItem & pitem) /比较品种代码,比较结果为1,0 return (I

7、tem_code=pitem.Item_code); int CItem:SetItem(int n) /置品种数据,正确返回1,当n为1时,是新进货物,输出至出清单文件 cout输入商品名称: ; Flush(cin);/把输入流固化,不会对程序造成太大的影响 cin.getline(Item_name,20); coutItem_code; cout输入商品颜色: ; Flush(cin); cin.getline(colour,20); cout输入品牌数: nBrnd; /循环实现品牌数据的输入,count为商品总数 for(int i=0,count=0;inBrnd;i+) cou

8、t输入品牌?椼?的数据n; cout输入品牌名称: ; Flush(cin); cin.getline(brndi.brnd_name,20); coutbrndi.Brand_code; coutbrndi.quantity; coutbrndi.brnd_price; void customer:getdata(); count+=brndi.quantity; quantity=count; if(n=1) 景瑳敲浡映汩?进货清单.txt,ios:out|ios:ate); if(!file) 潣瑵?错误,不能打开文件.; getch(); exit(1); timer=time(NUL

9、L); filectime(&timer); 楦敬?品种?尼屜屴?代码?尼屜屴?颜色; fileItem_name Item_code colour; ; 价格?尼屜屴?数量?尼屜屴?代码?尼屜屴?品牌楦敬? for(int i=0;inBrnd;i+) filebrndi.brnd_name brndi.Brand_code brndi.quantity brndi.brnd_price; file; file.close(); return 1; void CItem:Show()/显示品种数据 潣瑵?品种?尼屜屴?代码?尼屜屴?颜色; coutItem_name Item_code co

10、lour; 潣瑵?品牌?尼屜屴?代码?尼屜屴?数量?尼屜屴?价格; for(int i=0;inBrnd;i+) coutbrndi.brnd_name brndi.Brand_code brndi.quantity brndi.brnd_price; coutnflush; system(pause);/命令行上输出一行类似于“press any key to exit”的字,等待用户按一个键,然后返回 cout; void CItem:OutModify()/出货,修改结点中的数据部分 int choice,count,chuhuo; float price=0; /chuhuo为出货量,

11、price为总价格 int *num; num=new intnBrnd; if(quantity=0) 潣瑵?数量为0.; exit(1); /随时结束程序 for(int i=0;inBrnd;i+) /储存原来的数量 numi=brndi.quantity; 潣瑵?品牌?尼屜屴?代码?尼屜屴?数量?尼屜屴? 价格; for(i=0;inBrnd;i+) couti+1.brndi.brnd_name brndi.Brand_code brndi.quantity brndi.brnd_price; coutchoice; while(choice=1&choicecount; while

12、(countbrndchoice-1.quantity) 潣瑵?库存不足,重新输入:; cincount; brndchoice-1.quantity-=count; 潣瑵?出货成功,按0退出或按数字继续出货.n; cinchoice; 景瑳敲浡映汩?出货清单.txt,ios:out|ios:ate); if(!file) 潣瑵?错误,不能打开文件 .; getch(); exit(1); timer=time(NULL); filectime(&timer); 楦敬?品种?尼屜屴?代码?尼屜屴? 颜色; fileItem_name Item_code colourn; 楦敬?品牌?尼屜屴?代

13、码 ?尼屜屴?价格?尼屜屴?出货量; for(i=0;inBrnd;i+) if(chuhuo=numi-brndi.quantity) price=chuhuo*brndi.brnd_price; filebrndi.brnd_name brndi.Brand_code brndi.brnd_price chuhuo; 楦敬?总价格为:pricen; delete num; file.close(); void CItem:InModify()/已有商品,再次进货,修改结点中的数据部分 char name20; char choice; int count,jinhuo=0; int pre

14、nBrnd=nBrnd; /原先品牌数 int n=1; /用于判断是否继续进货 int flag=0; /用于判断是否新品牌 int * num; num=new intprenBrnd; for(int i=0;inBrnd;i+) /储存原来的数量 numi=brndi.quantity; while(n) coutn输入品牌名称:; Flush(cin); cin.getline(name,20); for(int i=0;inBrnd;i+) if(strcmp(brndi.brnd_name,name)=0) coutcount; brndi.quantity+=count; qu

15、antity+=count; flag=1; break; if(flag=0) strcpy(brndnBrnd.brnd_name,name); coutbrndnBrnd.Brand_code; : ; 输入数量coutbrndnBrnd.quantity; coutbrndnBrnd.brnd_price; quantity+=brndnBrnd.quantity; nBrnd+; coutchoice; if(choice=y|choice=Y) n=1; else n=0; 景瑳敲浡映汩?进货清单.txt,ios:out|ios:ate); if(!file) 潣瑵? 错误,不能打

16、开文件.; getch(); exit(1); timer=time(NULL); filectime(&timer); 楦敬?品种?尼屜屴? 代码?尼屜屴?颜色; fileItem_name Item_code colourn; 楦敬?品牌?尼屜屴? 代码?尼屜屴?价格?尼屜屴?进货量; for(i=0;iprenBrnd;i+) if(jinhuo=brndi.quantity-numi) filebrndi.brnd_name brndi.Brand_code brndi.brnd_price jinhuoprenBrnd) for(i=prenBrnd;inBrnd;i+) fileb

17、rndi.brnd_name brndi.Brand_code brndi.brnd_price brndi.quantity; filepNext=0; else pnode-pNext=pHead; pHead=pnode; CNode * CList:DeleteNode(CNode *pnode)/删除一个指定的结点,返回该结点的指针 if(pnode=pHead)/删除的结点是链表的首结点 pHead=pnode-pNext; pnode-pNext=0; else CNode *p=pHead; while(p-pNext!=pnode) p=p-pNext; p-pNext=pn

18、ode-pNext;/删除结点后将前后两个结点再连结起来 pnode-pNext=0; return(pnode); CNode * CList:LookUp(CItem &pitem)/*查找一个指定的数据,返回该数据所在结点在链表中的指针,若未找 到返回0 */ CNode * pn=pHead; if(pitem.GetItemCode()=0) while(pn) if(pn-pData-Compare(pitem) return pn;/按品种名称查找 pn=pn-pNext; else while(pn) if(pn-pData-CompareCode(pitem) return

19、pn;/按品种代码查找 pn=pn-pNext; return 0; void CList:ShowList()/打印整个链表 CNode * p=pHead; while(p) p-pData-Show(); p=p-pNext; void CList:DeleteList()/删除整个链表 CNode *p,*q; p=pHead; while(p) delete p-pData; q=p; p=p-pNext; delete q; CNode * CList:GetListNextNode(CNode *pnode)/返回链表指定结点的下一个结点 return pnode-pNext;

20、按代码的顺序插入一个结点void CList:Insert(CNode * pnode)/ CNode * p1,* p2; if(pHead=0) pHead=pnode; pnode-pNext=0; else if(pHead-pData-GetItemCode()=pnode-pData-GetItemCode() pnode-pNext=pHead; pHead=pnode; else p2=p1=pHead; while(p2-pNext&p2-pData-GetItemCode()pData-GetItemCode() p1=p2; p2=p2-pNext; if(p2-pDat

21、a-GetItemCode()pData-GetItemCode() p2-pNext=pnode; pnode-pNext=0; else pnode-pNext=p2; p1-pNext=pnode; void customer:getdata() /获取客户资料 cout输入客户名称: ; cin.getline(customer_name,10); coutcustomer_code; coutcustomer_tel; cout输入客户选择的品种名称: ; Flush(cin); cin.getline(customer_Item_name,10); : ; 输入客户选择的品牌名称cout cin.getline(customer_brnd_name,10); void customer:showdata() /显示客户资料 cout客户名称: ; coutcustomer_name; cout客户代码: ;

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1