c++编写仓库管理系统_第1页
c++编写仓库管理系统_第2页
c++编写仓库管理系统_第3页
c++编写仓库管理系统_第4页
c++编写仓库管理系统_第5页
已阅读5页,还剩7页未读 继续免费阅读

下载本文档

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

文档简介

C++编写仓库管理系统//functions.h#include<iostream>#include<string>#include<fstream>#include<cassert>#include<iomanip>#include<conio.h>usingnamespacestd;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<<"请输入用户名: ";cin>>username;cout<<"请输入密码:";cin>>passport;boolflag=false;while(storeFile>>username1>>passport1>>name1){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<<"商品入库,请输入相关信息: ";cout<<endl<<"\t 商品名称:";cin>>name;cout<<endl<<"\t 商品价格:";cin>>price;cout<<endl<<"\t 商品数量:";cin>>count;cout<<endl<<"\t 仓库编号:";cin>>storeNo;cout<<endl<<"\t 商品大类:";cin>>kinds;cout<<endl<<"\t 货架编号:";cin>>shelfNo;cout<<endl<<"\t 入库时间(例如: ):";cin>>time;ofstreamstoreFile("store.txt", ios::app);storeFile<<setiosflags(ios::left)<<setw(20)<<name<<" "<<setw(15)<<price<<""<<setw(10)<<count<<""<<setw(10)<<storeNo<<""<<setw(20)<<kinds<<""<<shelfNo<<" "<<setw(20)<<time<<endl;storeFile.close();cout<<"\n\n\t 该商品已经入库⋯⋯ \n\n\t";cout<<"是否继续?1.是 2.否"<<endl;inta;cin>>a;if(a==1){in_storage();}if(a==2){first_face();choice();}system("pause");//系统暂停}出库voidout_storage(){system("cls");//系统清屏stringname;//商品名cout<<endl<<"\t 商品出库,输入出库商品信息: "<<endl;cout<<"\n\t 商品名称:";cin>>name;ifstreamstoreFile("store.txt");if(!storeFile){ofstreamstoreFile1("store.txt");storeFile1.close();cout<<"\n\n\t 库存为空⋯⋯ \n\n\t";cout<<"是否继续?1.是 2.否"<<endl;inta;cin>>a;if(a==1){in_storage();}elseif(a==2){first_face();choice();}}boolflag=false;stringname1;//商品名doubleprice1;//价格stringstoreNo1;//仓库编号stringkinds1;//商品大类stringshelfNo1;//货架号longcount1=0;//商品数量ofstreamtempFile("temp.txt");while(storeFile>>name1>>price1>>count1>>storeNo1>>kinds1>>shelfNo1){if(name1==name)flag=true;else{tempFile<<setiosflags(ios::left)<<setw(20)<<name1<<" "<<setw(15)<<price1<<""<<setw(10)<<count1<<""<<setw(10)<<storeNo1<<""<<setw(20)<<kinds1<<""<<shelfNo1<<endl;}}tempFile.close();storeFile.close();if(!flag){cout<<"\n\n\t 仓库中没有该商品! \n\n\t";system("pause");return;}ofstreamstoreFile1("store.txt");ifstreamtempFile1("temp.txt");storeFile1<<tempFile1.rdbuf();storeFile1.close();tempFile1.close();cout<<"\n\t这些商品已经出库,请仔细检查!!!\n\n\t";cout<<"是否继续?1.是2.否"<<endl;inta;cin>>a;if(a==1){out_storage();}if(a==2){first_face();choice();}system("pause");}查询voidselect_ele(){while(1){system("cls");cout<<"\n"<<endl;cout<<"\t================================"<<endl<<"\t"<<endl<<"\t 商品查询"<<endl<<"\t"<<endl<<"\t1. 按商品名称查询 "<<endl<<"\t"<<endl<<"\t2. 按入库时间查询 "<<endl<<"\t"<<endl<<"\t3. 查看所有商品 "<<endl<<"\t"<<endl<<"\t4. 按商品大类查询 "<<endl<<"\t"<<endl<<"\t5. 返回"<<endl<<"\t"<<endl<<"\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");cout<<endl<<"\t 按商品名查询: "<<endl;cout<<"\n\t 输入商品名: ";stringname;cin>>name;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(storeFile>>name1>>price1>>count1>>storeNo1>>kinds1>>shelfNo1>>time1){if(name1==name){flag=true;cout<<setiosflags(ios::left)<<""<<name1<<""<<price1<<""<<count1<<""<<storeNo1<<""<<kinds1<<""<<shelfNo1<<""<<time1<<endl;}}storeFile.close();if(!flag)cout<<"\n\n 对不起,库存中没 有这个商品⋯⋯ ";cout<<"\n"<<endl;system("pause");}voidselect_time()//按入库时间查询{system("cls");cout<<"\n\t 按入库时间查询 :"<<endl;cout<<"\n\t 输入入库时间 (例如::";stringtime;cin>>time;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)<<"货架号\n"<<endl;while(storeFile>>name1>>price1>>count1>>storeNo1>>kinds1>>shelfNo1>>time1){if(time1==time){flag=true;cout<<setiosflags(ios::left)<<setw(15)<<name1<<" "<<setw(10)<<price1<<""<<setw(10)<<count1<<""<<setw(10)<<storeNo1<<""<<setw(15)<<kinds1<<""<<shelfNo1<<endl;}}storeFile.close();if(!flag)cout<<"\n\n 对不起,仓库中没 有这类商品!";cout<<"\n"<<endl;system("pause");}voidselect_all()//查看所有商品{system("cls");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(storeFile>>name1>>price1>>count1>>storeNo1>>kinds1>>shelfNo1>>time1){flag=true;cout<<setiosflags(ios::left)<<""<<name1<<""<<price1<<""<<count1<<""<<storeNo1<<""<<kinds1<<""<<shelfNo1<<""<<time1<<endl;}storeFile.close();system("pause");}按大类查询voidselect_kind(){system("cls");cout<<"\n\t 按商品大类查询 :"<<endl;cout<<"\n\t 输入大类名: ";stringkinds;cin>>kinds;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商品名 "<<"价格"<<"商品数量 "<<"仓库编号 "<<"商品大类 "<<"货架号 "<<" 入库时间"<<endl;while(storeFile>>name1>>price1>>count1>>storeNo1>>kinds1>>shelfNo1>>time1){if(kinds1==kinds){flag=true;cout<<setiosflags(ios::left)<<setw(15)<<name1<<" "<<setw(10)<<price1<<""<<setw(10)<<count1<<""<<setw(10)<<storeNo1<<""<<setw(15)<<kinds1<<""<<shelfNo1<<""<<setw(15)<<time1<<endl;}}storeFile.close();if(!flag)cout<<"\n\n 对不起,库存中没 有这类商品⋯⋯ ";cout<<"\n"<<endl;system("pause");}voidzhuce(){system("cls");//系统清屏stringusername,passport,passport1,name,miyao,jiami;cout<<"请输入用户名: ";cin>>username;cout<<"请输入密码:";cin>>passport;cout<<"请再次输入密码: ";cin>>passport1;if(passport==passport1){cout<<"请输入您的姓名: ";cin>>name;}elseif(passport!=passport1){cout<<"两次输入的密码不一致,请重新输 入!"<<endl;;while(passport!=passport1){cout<<"请输入密码:";cin>>passport;cout<<"请再次输入密码: ";cin>>passport1;}cout<<"请输入您的姓名: ";cin>>name;}ofstreamstoreFile("userdate.txt", ios::app);storeFile<<setiosflags(ios::left)<<setw(15)<<username<<" "<<setw(15)<<passport<<""<<setw(10)<<name<<endl;storeFile.close();system("cls");cout<<"账户创建成功!欢迎您, "<<name<<endl;system("pause");system("cls");first_face();choice();}voidcall()//提醒功能{system("cls");ifstreamstoreFile("store.txt");boolflag=false;stringname1;//商品名doubleprice1;//价格stringstoreNo1;//仓库编号stringki

温馨提示

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

评论

0/150

提交评论