c++综合实验-儿童商品仓库管理系统报告_第1页
c++综合实验-儿童商品仓库管理系统报告_第2页
c++综合实验-儿童商品仓库管理系统报告_第3页
c++综合实验-儿童商品仓库管理系统报告_第4页
c++综合实验-儿童商品仓库管理系统报告_第5页
已阅读5页,还剩16页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

西 南 交 通 大 学课程设计 年 级: 学 号: 姓 名: 专 业: 指 导 老 师: 二零一三年六月一.课程设计要求(简要描述课程设计的要求)实现一个简单的儿童商品仓库管理系统。系统的主要功能是登记仓库中各个儿童用品的信息情况,对部分信息进行检查和处理,并将结果保存。假设仓库中有3种不同类型的商品:食品、鞋子、玩具。对于食品,要求检查是否过期,并作相应处理;对于鞋子,要求检查是否是过季产品,如果是,就要做相应处理。二.模块划分(说明函数和类的定义)查看信息模块;添加货物模块;取出货物模块;修改信息模块; 三.源程序(程序代码,附部分注释)#include stdafx.h#include time.h#include using namespace std;struct timesint year,month,day;class childgoodspublic:virtual void inputinformation()=0;virtual void add()=0;void totalnumber();public:char name20;double number;float bid;/进价;int stock;/库存;times storage_time;/入库时间;int inputnumber;class food :public childgoodspublic:food()next=NULL;void inputinformation();void changeinformation(food *f);void add();void show(food *f);void showall();friend void addfood(food *f);friend void getfood(food *f);public:times shelf_life;/保质期; food *next;void food:show(food *f)int num;food *temp;cout请输入所要查看货物的编号.num;temp=f;if(temp-number=num)temp-showall();elsewhile(temp!=NULL)if(temp-number=num)break;temp=temp-next;temp-showall();void food:showall()cout名称 编号 进价 库存 入库时间:年 月 日 保质期:年 月 日endl;coutname number bid stock storage_time.year storage_time.month storage_time.day shelf_life.year shelf_life.month shelf_life.daynowtime)cout本食品尚未过期.endl;elsecout本食品已过期,请尽快处理!endl;void food:inputinformation()cout名称:name;cout编号:number;cout进价:bid;cout入库数量:inputnumber;cout入库时间:endlstorage_time.year;coutstorage_time.month;coutstorage_time.day;cout保质期:endlshelf_life.year;coutshelf_life.month;coutshelf_life.day;stock=inputnumber;void food:changeinformation(food *f)int option,changenum;food *temp=*f;cout请输入要修改货品的编号:changenum;while(temp!=NULL)if(temp-number=changenum)break;temp=temp-next;if(temp=NULL)cout仓库内无此货品。endl;elsecout1.名称 2.编号 3.进价 4.库存 option;while(option4|option1)cout输入不合法,请重新输入。endl;cout1.名称 2.编号 3.进价 4.库存 option;switch(option)case 1:cout请输入新名称:temp-name;break;case 2:cout请输入新编号:temp-number;break;case 3:cout请输入新进价:temp-bid;break;case 4:cout请输入新库存:temp-stock;break;default:cout输入不合法,请重新输入。endl;class shoe :public childgoodspublic:void inputinformation();void changeinformation(shoe *s);void add();void show(shoe *s);void showall();void showone();friend void addshoe(shoe *s);friend void getshoe(shoe *s);public:char season20;shoe *now;shoe *next;void shoe:inputinformation()cout名称:name;cout编号:number;cout进价:bid;cout适合季节:season;cout入库数量:inputnumber;cout入库时间:endlstorage_time.year;coutstorage_time.month;cout日:;void shoe:changeinformation(shoe *s)int option,changenum;shoe *temp=*s;cout请输入要修改货品的编号:changenum;while(temp!=NULL)if(temp-number=changenum)break;temp=temp-next;if(temp=NULL)cout仓库内无此货品。endl;elsecout1.名称 2.编号 3.进价 4.库存 option;while(option4|option1)cout输入不合法,请重新输入。endl;cout1.名称 2.编号 3.进价 4.库存 option;switch(option)case 1:cout请输入新名称:temp-name;break;case 2:cout请输入新编号:temp-number;break;case 3:cout请输入新进价:temp-bid;break;case 4:cout请输入新库存:temp-stock;break;default:cout输入不合法,请重新输入。endl;void shoe:showall()cout名称 编号 进价 适合季节 库存 入库时间:年 月 日 endl;coutname number bid season stock storage_time.year storage_time.month storage_time.dayendl;void shoe:show(shoe *s)int num;shoe *temp;cout请输入所要查看货物的编号.num;temp=s;if(temp-number=num)temp-showall();elsewhile(temp!=NULL)if(temp-number=num)break;temp=temp-next;temp-showall();class toy :public childgoodspublic:void inputinformation();void changeinformation(toy *t);void add();void show(toy *t);void showall();void showone();friend void addtoy(toy *t);friend void gettoy(toy *t);public:int fitage2;toy *now;toy *next;void homepage(food *f,shoe *s,toy *t);void quit(food *f,shoe *s,toy *t);void addgoods(food *f,shoe *s,toy *t);void toy:show(toy *t)int num;toy *temp;cout请输入所要查看货物的编号.num;temp=t;if(temp-number=num)temp-showall();elsewhile(temp!=NULL)if(temp-number=num)break;temp=temp-next;temp-showall();void toy:inputinformation()cout名称:name;cout编号:number;cout进价:bid;cout适合年龄endlfitage0;coutfitage1;cout入库数量:inputnumber;cout入库时间:endlstorage_time.year;coutstorage_time.month;coutstorage_time.day;void toy:changeinformation(toy *t)int option,changenum;toy *temp=*t;cout请输入要修改货品的编号:changenum;while(temp!=NULL)if(temp-number=changenum)break;temp=temp-next;if(temp=NULL)cout仓库内无此货品。endl;elsecout1.名称 2.编号 3.进价 4.库存 option;while(option4|option1)cout输入不合法,请重新输入。endl;cout1.名称 2.编号 3.进价 4.库存 option;switch(option)case 1:cout请输入新名称:temp-name;break;case 2:cout请输入新编号:temp-number;break;case 3:cout请输入新进价:temp-bid;break;case 4:cout请输入新库存:temp-stock;break;default:cout输入不合法,请重新输入。endl;void toy:showall()cout名称 编号 进价 适合年龄:从 到 库存 入库时间:年 月 日 endl;coutname number bid fitage0 fitage1 stock storage_time.year storage_time.month storage_time.dayinputinformation();if(*f=NULL)*f=temp;(*f)-next=NULL;elsewhile(*f)-next!=NULL)(*f)-next=(*f)-next-next;(*f)-next=temp;(*f)-next-next=NULL;void addshoe(shoe *s)shoe *temp=new shoe;temp-inputinformation();if(*s=NULL)*s=temp;(*s)-next=NULL;elsewhile(*s)-next!=NULL)(*s)-next=(*s)-next-next;(*s)-next=temp;(*s)-next-next=NULL;void addtoy(toy *t)toy *temp=new toy;temp-inputinformation();if(*t=NULL)*t=temp;(*t)-next=NULL;elsewhile(*t)-next!=NULL)(*t)-next=(*t)-next-next;(*t)-next=temp;(*t)-next-next=NULL;void addgoods_recycle(food *f,shoe *s,toy *t)int option;cout*endl * 1.继续添加 *endl * 2.返回首页 *endl * 0.退出系统 *endl *option;switch(option)case 0: quit(f,s,t);break;case 1: addgoods(f,s,t);break;case 2: homepage(f,s,t);break;default:cout输入不合法,请重新输入。endl;addgoods_recycle(f,s,t);void addgoods(food *f,shoe *s,toy *t)int option;cout您要添加哪种货物?endl1.食品 2.鞋 3.玩具option;switch(option)case 1:addfood(&f);break;case 2:addshoe(&s);break;case 3:addtoy(&t);break;default:cout输入不合法,请重新输入。endl;addgoods(f,s,t);cout货物添加成功。endl;addgoods_recycle(f,s,t);void getgoods_recycle(food *f,shoe *s,toy *t);void getfood(food *f,shoe *s,toy *t)int num,getnum;food *temp=*f;cout请输入物品编号:num;cout请输入取出数量:getnum;if(*f=NULL)cout仓库内无食品类货物!number=num)while(temp-stockgetnum)cout数量不足!请重新输入:getnum;temp-stock-=getnum;cout取出成功!库内剩余数量为:stocknext;if(temp=NULL)cout无此货品!endl;getgoods_recycle(*f,s,t);void getshoe(food *f,shoe *s,toy *t)int num,getnum;shoe *temp=*s;cout请输入物品编号:num;cout请输入取出数量:getnum;if(*s=NULL)cout仓库内无食品类货物!number=num)while(temp-stockgetnum)cout数量不足!请重新输入:getnum;temp-stock-=getnum;cout取出成功!库内剩余数量为:stocknext;if(temp=NULL)cout无此货品!endl;getgoods_recycle(f,*s,t);void gettoy(food *f,shoe *s,toy *t)int num,getnum;toy *temp=*t;cout请输入物品编号:num;cout请输入取出数量:getnum;if(*t=NULL)cout仓库内无食品类货物!number=num)while(temp-stockgetnum)cout数量不足!请重新输入:getnum;temp-stock-=getnum;cout取出成功!库内剩余数量为:stocknext;if(temp=NULL)cout无此货品!endl;getgoods_recycle(f,s,*t);void getgoods(food *f,shoe *s,toy *t);void getgoods_recycle(food *f,shoe *s,toy *t)int option;cout*endl * 1.继续取出 *endl * 2.返回首页 *endl * 0.退出系统 *endl *option;switch(option)case 0: quit(f,s,t);break;case 1: getgoods(f,s,t);break;case 2: homepage(f,s,t);break;default:cout输入不合法,请重新输入。endl;getgoods_recycle(f,s,t);void getgoods(food *f,shoe *s,toy *t)int option;cout取出 1.食品 2.鞋 3.玩具option;switch(option)case 1:getfood(&f,s,t);break;case 2:getshoe(f,&s,t);break;case 3:gettoy(f,s,&t);break;default:cout输入不合法,请重新输入。endl;getgoods(f,s,t);void checkgoods(food *f,shoe *s,toy *t);void checkgoods_recycle(food *f,shoe *s,toy *t)int option;cout*endl * 1.继续查看 *endl * 2.返回首页 *endl * 0.退出系统 *endl *option;switch(option)case 0: quit(f,s,t);break;case 1: checkgoods(f,s,t);break;case 2: homepage(f,s,t);break;default:cout输入不合法,请重新输入。endl;checkgoods_recycle(f,s,t);void checkgoods(food *f,shoe *s,toy *t)int option;cout您要查看哪种货物?endl1.食品 2.鞋 3.玩具option;switch(option)case 1:f-show(f);break;case 2:s-show(s);break;case 3:t-show(t);break; default:cout输入不合法,请重新输入。endl;checkgoods(f,s,t);cout查看完毕.endl;checkgoods_recycle(f,s,t);void changeinfor(food *f,shoe *s,toy *t);void changeinfor_recycle(food *f,shoe *s,toy *t)int option;cout*endl * 1.继续修改 *endl * 2.返回首页 *endl * 0.退出系统 *endl *option;switch(option)case 0: quit(f,s,t);break;case 1: changeinfor(f,s,t);break;case 2: homepage(f,s,t);break;default:cout输入不合法,请重新输入。endl;changeinfor_recycle(f,s,t);void changeinfor(food *f,shoe *s,toy *t)int option;cout1.食品 2.鞋 3.玩具option;switch(option)case 1:f-changeinformation(&f);break;case 2:s-changeinformation(&s);break;case 3:t-changeinformation(&t);break;default:cout输入不合法,请重新输入。endl;changeinfor(f,s,t);changeinfor_recycle(f,s,t);void quit(food *f,shoe *s,toy *t)char

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论