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

下载本文档

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

文档简介

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()

stringusernamel^passportl^amel;

stringusername,passport;

ifstreamstoreFile("userdate.txt");

if(istoreFile)

(

cout«"\n\n\t对不起,顾客文献丢失。。。\n\n\t";

systemf'pause");

return;

)

coutcc"顾客登录:"«endl;

cout«”请输入顾客名:

cin»username;

coutcc”请输入密码:

cin»passport;

boolflag=false;

while(storeFile»usernamel»passportl»namel)

if(usernamel==u$ername&&passportl==passport)

flag=true;

systemf'cls");

cout<<"登录成功!"<<endl;

cout<<"欢迎您,"<<namel<<"A_A"<<endl;

systemf'pause");

)

elseif(usernamel==username11passportl==passport){

cout<<”顾客名或密码错误!"<<endl;

denglu();

)

)

storeFile.close();

call();

choice();

)

voidchoice()

(

chara;

a=first_face();

while(l){

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(O);

break;

dexault: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<<“商品入库,请输入有关信息:

8ut«endl«"\t商品名称:

cin»name;

cout«endl«"\t商品价格:

cin»price;

cout«endl«"\t商品数量:

cin»count;

cout«endk<"\t仓库编号:

cin»storeNo;

cout«endl«"\t商品大类:

cin»kinds;

cout«endl«"\t货架编号:

cin»shelfNo;

cout«endl«”\t入库时间(例如:2023.01.01):

cin»time;

ofstreamstoreFileC'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.否"cvendl;

inta;

cin»a;

if(a==l){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(istoreFile)

ofstreamstoreFilelCstore.txt");

storeFilel.closef);

cout«*'\n\n\t库存为空……\n\n\t";

cout<<"与否继续?1.是2.否"<<endl;

inta;

cin»a;

if(a==l){in_storage();}

elseif(a==2){

first_face();

choice!);}

)

boolflag=false;

stringnamel;〃商品名

doublepricel;〃价格

stringstoreNol;〃仓库编号

stringkindsl;〃商品大类

stringshelfNol;〃货架号

longcountl=0;〃商品数量

ofstreamtempFile("temp.txt");

while(storeFile»namel»pricel»countl»storeNol»kindsl»shelfNol)

if(namel==name)

flag=true;

else

(

tempFile«setiosflags(ios::left)«setw(20)«namel«""

«setw(15)«pricel<<""«setw(10)«countl<<""

<<setw(10)«storeNol«""«setw(20)«kindsl«"

«shelfNol«endl;

)

)

tempFile.close();

storeFile.closeO;

if(!flag)

(

cout«"\n\n\t仓库中没有该商品!\n\n\t";

system("pause");

return;

)

ofstreamstoreFilel("store.txt");

ifstreamtempFilelf'temp.txt");

storeFilel«tempFilel.rdbuf();

storeFilel.close();

tempFilel.close();

cout«"\n\t这些商品己经出库,请仔细检查!!!\n\n\t";

cout<<"与否继续?1.是2.否"<<endl;

inta;

cin»a;

if(a==l){out_storage();}

if(a==2){

first_face();

choicef);

)

system("pause");

)

〃查询

voidselect_ele()

(

while(1)

(

system("cls");

cout«"\n"«endl;

cout«"\t================================"«endl

«"\t"«endl

«"\t商品杳询”<<endl

«"\t"«endl

«"\tl.按商品名称查询”<<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'l':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;

stringname];〃商品名

stringtimel;

doublepricel;〃价格

stringstoreNo1;〃仓库编号

stringkindsl;〃商品大类

stringshelfNol;〃货架号

longcountl=0;〃商品数量

ifstreamstoreFile("sto-e.txt");

if(istoreFile)

cout«"\n\n\t对不起,你的库存为空……\n\n\t";

system("pause");

return;

)

boolflag=false;

cout«”\n商品名价格商品数量“仓库编号"

<<"商品大类货架号"«"入库时间”<<endl;

while(storeFile»namel»pricel»countl»storeNol»kindsl»shelfNol»timel)

(

if(namel==name]

(

flag=true;

cout«setiosflags(ios::left)«""«namel«""

«pricel«""«countl«""

«storeNol«""«kindsl«""

«shelfNol«""«timel«endl;

)

)

storeFile.close();

if(lflag)

cout«"\n\n对不起,库存中没有这个商品••

cout«"\n"«endl;

system("pause");

)

voidselect_time()〃按入库时间查询

(

system("cls");

cout«"\n\t按入库时间查ifU:"«endl;

cout«”\n\t输入入库时间(例如:2023.01.01):

stringtime;

cin»time;

stringname];〃商品名

doublepricel;〃价格

stringstoreNol;〃仓库编号

stringkindsl;〃商品大类

stringshelfNol;〃货架号

stringtimel;

longcountl=0;〃商品数量

ifstreamstoreFileC'sto,e.txt");

if(lstoreFile)

cout«*'\n\n\t对不起,你日勺库存为空……\n\n\t";

system("pause");

return;

)

boolflag=false;

cout«"\n商品名价格商品数量"<<setw(10)<<“仓库编

号"

<<setw(10)<<“商品大类"«setw(15)«"^^^-\n"«endl;

while(storeFile»namel»pricel»countl»storeNol»kindsl»shelfNol»timel)

(

if(timel==time)

(

flag=true;

cout«setiosflags(ios::left)«setw(15)«namel«""

«setw(10)«pricel«""«setw(10)«countl<<""

<<setw(10)«storeNol«""«setw(15)«kindsl«""

«shelfNol«endl;

)

)

storeFile.close();

if(!flag)

cout<<"\n\n对不起,仓库中没有此类商品!

cout«"\n"«endl;

system("pause");

)

voidselect_all()〃查看所有商品

(

system("cls");

stringnamel;〃商品名

stringtimel;〃入库时间

doublepricel;〃价格

stringstoreNol;〃仓库编号

stringkindsl;〃商品大类

stringshelfNol;〃货架号

longcountl=0;〃商品数量

ifstreamstoreFile("sto-e.txt");

if(lstoreFile)

(

cout«"\n\n\t对不起,你II勺库存为空……\n\n\t";

system("pause");

return;

)

boolflag=false;

cout«”\n商品名"<<“价格”<<"商品数量仓库编号"

<<"商品大类“<<”货架号n«"入库时间,,<<endl;

while(storeFile»namel»pricel»countl»storeNol»kindsl»shelfNol»timel)

(

flag=true;

cout«setiosflags(ios::left)«""«namel«""

«pricel«""«countl«""

«storeNol«""«kindsl«""

«shelfNol«""«timel«endl;

)

storeFile.closeO;

system("pause");

)

〃按大类查询

voidselect_kind()

(

system("cls");

cout«"\n\t按商品大类查询:"<<endl;

cout«”\n\t输入大类名:

stringkinds;

cin»kinds;

stringnamel;〃商品名

doublepricel;〃价格

stringstoreNol;〃仓库编号

stringkindsl;〃商品大类

stringshelfNol;〃货架号

stringtimel;〃入库时间

longcountl=0;〃商品数量

ifstreamstoreFile("sto-e.txt");

if(!storeFile)

(

cout«"\n\n\t对不起,你口勺库存为空……\n\n\t";

system("pause");

return;

)

boolflag=false;

cout«"\n商品名价格商品数量“仓库编号"

<<"商品大类"«"货架号"«"入库时间"<<endl;

while(storeFile»namel»pricel»countl»storeNol»kindsl»shelfNol»timel)

if(kindsl==kinds)

flag=true;

cout«setiosflags(ios::left)«setw(15)«namel<<""

<<setw(10)«pricel«""<<setw(10)«countl«""

«setw(10)«storeNol<<""«setw(15)«kindsl«"

«shelfNol«""«setw(15)«timel«endl;

)

)

storeFile.close();

if(!flag)

cout«"\n\n对不起,库存中没有此类商品...

cout«"\n"«endl;

system("pause");

)

voidzhuce()

(

system("ds");〃系统清屏

stringusername,passport,passportl,name,miyaojiami;

cout<<”请输入顾客名:

cin»username;

COUt<<"请输入密码:

cin»passport;

cout<<”请再次输入密码:

cin»passportl;

if(passport==passportl){

cout<<”请输入您的姓名:

cin»name;

)

elseit(passport!=passportl){

cout<<”两次输入的密码不一致,请重新输入!"«endl;;

while(passport!=passportl)

(

COUt<<"请输入密码:

cin»passport;

cout<<”请再次输入密码:";

cin»passportl;

)

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");

systemf'cls");

first_face();

choicef);

)

voidcall()〃提醒功能

(

systemC'cls");

ifstreamstoreFileC'sto'e.txt");

boolflag=false;

stringnamel;〃商品名

doublepricel;〃价格

stringstoreNol;〃仓库编号

stringkindsl;〃商品大类

温馨提示

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

评论

0/150

提交评论