您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 管理学资料 > c++编写仓库管理系统
C++编写仓库管理系统//functions.h#includeiostream#includestring#includefstream#includecassert#includeiomanip#includeconio.husingnamespacestd;voiddenglu();voidchoice();voidzhuce();charfirst_face();voidin_storage();voidselect_time();voidout_storage();voidselect_ele();voidselect_name();voidselect_kind();voidselect_all();voidcall();voiddenglu(){stringusername1,passport1,name1;stringusername,passport;ifstreamstoreFile(userdate.txt);if(!storeFile){cout\n\n\t对不起,用户文件丢失。。。\n\n\t;system(pause);return;}cout用户登录:endl;cout请输入用户名:;cinusername;cout请输入密码:;cinpassport;boolflag=false;while(storeFileusername1passport1name1){if(username1==username&&passport1==passport){flag=true;system(cls);cout登录成功!endl;cout欢迎您,name1^_^endl;system(pause);}elseif(username1==username||passport1==passport){cout用户名或密码错误!endl;denglu();}}storeFile.close();call();choice();}voidchoice(){chara;a=first_face();while(1){switch(a){case'1':in_storage();break;case'2':out_storage();break;case'3':select_ele();break;case'4':system(cls);cout\t谢谢您的使用!\n\n\t\t;exit(0);break;default:break;}}}charfirst_face(){system(cls);//系统清屏cout===============================endl;cout**endl;cout*仓库管理系统*endl;cout**endl;cout*1.商品入库*endl;cout**endl;cout*2.商品出库*endl;cout**endl;cout*3.商品查询*endl;cout**endl;cout*4.退出系统*endl;cout**endl;cout===============================endl;returngetch();}//入库voidin_storage(){system(cls);//系统清屏stringname;//商品名doubleprice;//价格stringstoreNo;//仓库编号stringkinds;//商品大类stringshelfNo;//货架号longcount=0;//商品数量stringtime;//入库时间cout\n;cout商品入库,请输入相关信息:;coutendl\t商品名称:;cinname;coutendl\t商品价格:;cinprice;coutendl\t商品数量:;cincount;coutendl\t仓库编号:;cinstoreNo;coutendl\t商品大类:;cinkinds;coutendl\t货架编号:;cinshelfNo;coutendl\t入库时间(例如:2014.01.01):;cintime;ofstreamstoreFile(store.txt,ios::app);storeFilesetiosflags(ios::left)setw(20)namesetw(15)pricesetw(10)countsetw(10)storeNosetw(20)kindsshelfNosetw(20)timeendl;storeFile.close();cout\n\n\t该商品已经入库……\n\n\t;cout是否继续?1.是2.否endl;inta;cina;if(a==1){in_storage();}if(a==2){first_face();choice();}system(pause);//系统暂停}//出库voidout_storage(){system(cls);//系统清屏stringname;//商品名coutendl\t商品出库,输入出库商品信息:endl;cout\n\t商品名称:;cinname;ifstreamstoreFile(store.txt);if(!storeFile){ofstreamstoreFile1(store.txt);storeFile1.close();cout\n\n\t库存为空……\n\n\t;cout是否继续?1.是2.否endl;inta;cina;if(a==1){in_storage();}elseif(a==2){first_face();choice();}}boolflag=false;stringname1;//商品名doubleprice1;//价格stringstoreNo1;//仓库编号stringkinds1;//商品大类stringshelfNo1;//货架号longcount1=0;//商品数量ofstreamtempFile(temp.txt);while(storeFilename1price1count1storeNo1kinds1shelfNo1){if(name1==name)flag=true;else{tempFilesetiosflags(ios::left)setw(20)name1setw(15)price1setw(10)count1setw(10)storeNo1setw(20)kinds1shelfNo1endl;}}tempFile.close();storeFile.close();if(!flag){cout\n\n\t仓库中没有该商品!\n\n\t;system(pause);return;}ofstreamstoreFile1(store.txt);ifstreamtempFile1(temp.txt);storeFile1tempFile1.rdbuf();storeFile1.close();tempFile1.close();cout\n\t这些商品已经出库,请仔细检查!!!\n\n\t;cout是否继续?1.是2.否endl;inta;cina;if(a==1){out_storage();}if(a==2){first_face();choice();}system(pause);}//查询voidselect_ele(){while(1){system(cls);cout\nendl;cout\t================================endl\tendl\t商品查询endl\tendl\t1.按商品名称查询endl\tendl\t2.按入库时间查询endl\tendl\t3.查看所有商品endl\tendl\t4.按商品大类查询endl\tendl\t5.返回endl\tendl\t=================================endl;cout\n\t\t;charselect=getch();switch(select){case'1':select_name();break;case'2':select_time();break;case'3':select_all();break;case'4':select_kind();break;case'5':first_face();choice();break;default:break;}}}//按商品名称查询voidselect_name(){system(cls);coutendl\t按商品名查询:endl;cout\n\t输入商品名:;stringname;cinname;stringname1;//商品名stringtime1;doubleprice1;//价格stringstoreNo1;//仓库编号stringkinds1;//商品大类stringshelfNo1;//货架号longcount1=0;//商品数量ifstreamstoreFile(store.txt);if(!storeFile){cout\n\n\t对不起,你的库存为空……\n\n\t;system(pause);return;}boolflag=false;cout\n商品名价格商品数量仓库编号商品大类货架号入库时间endl;while(storeFilename1price1count1storeNo1kinds1shelfNo1time1){if(name1==name){flag=true;coutsetiosflags(ios::left)name1price1count1storeNo1kinds1shelfNo1time1endl;}}storeFile.close();if(!flag)cout\n\n对不起,库存中没有这个商品……;cout\nendl;system(pause);}voidselect_time()//按入库时间查询{system(cls);cout\n\t按入库时间查询:endl;cout\n\t输入入库时间(例如:2014.01.01):;stringtime;cintime;stringname1;//商品名doubleprice1;//价格stringstoreNo1;//仓库编号stringkinds1;//商品大类stringshelfNo1;//货架号stringtime1;longcount1=0;//商品数量ifstreamstoreFile(store.txt);if(!storeFile){cout\n\n\t对不起,你的库存为空……\n\n\t;system(pause);return;}boolflag=false;cout\n商品名setw(15)价格setw(10)商品数量setw(10)仓库编号setw(10)商品大类setw(15)货架号\nendl;while(storeFilename1
本文标题:c++编写仓库管理系统
链接地址:https://www.777doc.com/doc-3747358 .html