仓库管理系统C++课程设计报告Word下载.docx
《仓库管理系统C++课程设计报告Word下载.docx》由会员分享,可在线阅读,更多相关《仓库管理系统C++课程设计报告Word下载.docx(20页珍藏版)》请在冰豆网上搜索。
(1)设计classadmin管理库,实现对仓库信息的描叙;
classshelf柜台类库实现建立电器资料;
classele电器类,实现对电器的描述,电器的编号,货架号,名称,数量,价格等;
classmana函数类,实现对电器的入库,查找,出库等。
以下是函数功能表:
函数
功能
charfirst_face()
获取首页
voidshow_storage()
显示储存信息
voidin_storage()
电器入库
voidout_storage()
电器出库
voidselect_ele()
查询电器信息
voidselect_name()
按电器名查询
voidselect_price()
按电器价格查询
voidcall_s()
商品保存
(2)用类的成员函数对链表的数据进行操作,其功能如上表所列。
(3)设计菜单来实现功能设计
1、输入商品
2、商品查找
3、查询入库
4、商品出库
5、退出系统
3.设计类及对象
(1)本程序定义了四个类,定义如下:
classadmin
{
public:
admin();
private:
stringname;
};
classshelf
shelf();
stringstoreNo;
//仓库编号
stringshelfNo;
adminwe;
//货架号
classele
ele();
//商品名
doubleprice;
//介格
shelfsh;
//所属货架
longcount;
//商品数量
classmana
mana();
charfirst_face();
//首页
voidshow_storage();
//显示
voidin_storage();
//入库
voidout_storage();
//出库
voidselect_ele();
//查询
voidselect_name();
//按商品名称查询
voidselect_price();
//按商品价格查询
voidcall_s();
//商品保存
voidshow_storage1();
adminabs;
eleaele;
shelfashelf;
ele:
:
ele():
sh()
name="
xxx"
;
price=0.0;
count=0;
}
(2)分别利用类classadmin、classshelf、classele、classmana定义了各自的对象adminabs、shelfsh;
eleaele;
对其函数进行调用实现各种功能。
(3)主函数实现,调用各种函数。
4.程序源代码
#include<
iostream>
string>
fstream>
iomanip>
conio.h>
usingnamespacestd;
shelf:
shelf():
we()
storeNo="
shelfNo="
admin:
admin()
mana:
mana():
aele(),ashelf(),abs()
charmana:
first_face()
system("
cls"
);
cout<
<
endl;
endl<
"
\t\t◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆"
\t\t◆◆"
\t\t◆公司库存货物管理系统◆"
\t\t◆1.输入商品◆"
\t\t◆2.商品查找◆"
\t\t◆3.查询入库◆"
\t\t◆4.商品出库◆"
\t\t◆5.退出系统◆"
<
\t\t"
returngetch();
voidmana:
in_storage()
stringkinds;
//商品大类
longcount=0;
//商品数量
endl<
"
商品入库,请输入相关信息:
endl;
\t商品名称:
cin>
>
name;
\t商品介格:
price;
\t商品数量:
count;
\t仓库编号:
storeNo;
\t货架编号:
;
shelfNo;
ofstreamstoreFile("
store.txt"
ios:
app);
storeFile<
setiosflags(ios:
left)<
setw(20)<
name<
setw(15)<
price<
setw(10)<
count<
storeNo<
shelfNo<
storeFile.close();
\t该商品已经入库......."
\t"
pause"
show_storage(){
boolflag2=false;
stringname2;
doubleprice2;
stringstoreNo2;
stringshelfNo2;
longcount2=0;
ifstreamshowFile("
if(!
showFile)
\t对不起,你的库存为空"
return;
商品名"
价格"
商品数量"
仓库编号"
货架号"
while(showFile>
name2>
price2>
count2>
storeNo2>
shelfNo2)
name2<
price2<
count2<
storeNo2<
shelfNo2<
showFile.close();
getchar();
out_storage()
\t商品出库,输入出库商品信息:
ifstreamstoreFile("
storeFile)
ofstreamstoreFile1("
storeFile1.close();
\t仓存为空"
boolflag=false;
stringname1;
doubleprice1;
stringstoreNo1;
stringshelfNo1;
longcount2;
longcount1=0;
ofstreamtempFile("
temp.txt"
while(storeFile>
name1>
price1>
count1>
storeNo1>
shelfNo1)
if(name1==name)
flag=true;
while(name1==name)
cout<
\t请输入要取出的商品数量:
cin>
count2;
count1=count1-count2;
break;
tempFile<
name1<
price1<
count1<
storeNo1<
setw(10)<
shelfNo1<
tempFile.close();
flag)
\t仓库中没有这种商品"
ifstreamtempFile1("
storeFile1<
tempFile1.rdbuf();
tempFile1.close();
\t这些商品已经出库,请仔细检查"
select_ele()
while
(1)
\t============================================================="
endl
\t||||"
\t||商品查询||"
\t||1.按商品名称查询||"
\t||2.按商品价格查询||"
\t||3.返回||"
charselect=getch();
switch(select)
case'
1'
select_name();
2'
select_price();
3'
default:
select_name()
\t按商品名查询:
\t输入商品名:
longcount1=0;
name1>
if(name1==name)
flag=true;
对不起,库存中没有这种商品"
show_storage1(){
ifstreamtempFile3("
while(tempFile3>
tempFile3.close;
select_price()
\t按商品价格查询:
\t输入价格:
if(price1==price)
对不起,库存中没有这个价格的商品"
intmain()
charselect;
manamen;
while(select=men.first_face())
men.show_storage();
men.select_ele();
men.in_storage();
4'
men.out_storage();
6'
men.show_storage1();
5'
谢谢使用"
exit(0);
return0;
5.调试纪录
1、电器管理界面
2、程序的主界面以及图书维护界面
3、查找读者功能界面
6.总结
通过这次课程设计,让我了解了更多关于设计时容易出现的错误,而且进一步的认识到平时学习积累的重要性。
在刚进行编译的时候发现了很多的错误,都是平时应该注意的细节问题,还好与同学进行了很好的交流,得以纠正错误。
由于能力问题,我只能设计这个简单的图书管理系统。
它存在很多缺陷,在很多地方都存在不足。
编写程序最重要的是谨慎,认真,因为哪怕是一个字符或一个标点的错误都会导致程序的错误,从而使程序无法调试运行。
由这次编写课程设计的过程中让我更加了解到了自己的不足,那就是对编写程序的经验不足以及对理论知识的掌握不够透彻,以致程序中还存在许多缺点。
如:
在程序中还有部分功能不能按我的意识表达运行,当经人指点还是比较不错的实现了。
参考资料
本程序参考书本:
<<C++程序设计课程设计>>
<<高级语