C++课程设计报告格式.docx
《C++课程设计报告格式.docx》由会员分享,可在线阅读,更多相关《C++课程设计报告格式.docx(23页珍藏版)》请在冰点文库上搜索。
C++课程设计报告格式
C++课程设计报告
专业:
软件工程
学号:
15103404
姓名:
韩晨昱
提交日期:
2017-1-12
【设计目的】
1.设计一个较为简单的《商场库存货物管理系统,进一步熟悉C++中类的概念、类的封装、继承的实现方式。
2.了解系统开发的需求分析、类层次设计、模块分析、编码测试、模块组装与整体调试的全过程,加深对C++的理解与VisualC++环境的使用;逐步熟悉程序设计的方法,并养成良好的编程习惯。
【设计内容】
该程序用于商场对于货物整理查询的等需求,为了更好的处理货物的详细信息包括货物的入库,出库,查询,统计并且能够了解商场仓库系统。
能够查找,增加,删除,保存各类商品的信息。
使商场的管理者对于商场内的货物信息状况有一个准确的了解,并及时对商场的情况做一个及时的调整。
作为一个商场系统,添加了货物的新功能,深层次多方面的简化了货物关系的整体性。
系统要求能够按编号显示,查找,增加删除和保存各类信息,输入和输出货物的有关信息,并且对输入保存文件里确定程序具备以下工能:
查询模块,增加模块,删除模块,货物的有关数据存盘等基本模块,作为一个完整得系统,除了具有增加货物删除模块,还具有修改货物相关信息的功能,所以本系统具备了,‘商品入库’‘商品出库’‘查询统计’’商品报损’’’查询统计’这5个基本的功能,就可以用简洁的方式实现对货物的管理也就实现了系统的要求
【实验环境】
1.硬件环境:
ASUS电脑(8G内存,酷睿I5)
2.软件环境:
windows10操作系统,visualstudio2015。
【设计中使用函数说明】
charmanage:
:
homepage()操作主页函数
voidmanage:
:
instorage()入库函数
voidmanage:
:
outstorage()出库函数
voidmanage:
:
find()查询函数
voidmanage:
:
findname()按名称查询函数
voidmanage:
:
findprice()按价格查找函数
voidmanage:
:
findkind()按种类查找
voidmanage:
:
call_break()报损函数
【测试结果】
1.商场库存管理首页**********
2.商品的入库管理***********
3.商品查询**************
4.商品报损********************
5.商品出库********************
【设计总结】
通过小组人员的共同努力,使我们能够基本掌握C++程序设计的方法,并且在此基础上掌握类的构造方法,明确类中构造函数、成员函数的建立以及调用,此外,通过不断地练习C++编码方式,我们得以将自己所学通过代码表现出来,培养了我们的团队意识,增加了我们编码的熟练度。
【参考文献】
《C++面向对象程序设计(谭浩强)》
【源程序清单】
#include
#include
#include
#include
#include
#include
#include"类.h"
#include"函数.h"
usingnamespacestd;
classadministor
{
public:
administor();
private:
stringname;
};
//仓库货架类
classshelf
{
public:
shelf();
private:
administoradministor;//管理员
stringstoreNo;//仓库编号
stringkinds;//商品大类
stringshelfNo;//货架号
};
classgoods
{
public:
goods();
private:
stringname;//商品名
doubleprice;//价格
shelfshelf;//所属货架
longnumber;//商品数量
};
//管理类
classmanage
{
public:
manage();
charhomepage();//首页
voidinstorage();//入库
voidoutstorage();//出库
voidfind();//查询
voidfindname();//按商品名称查询
voidfindprice();//按商品价格查询
voidfindkind();//按大类查询
voidcall_break();//商品报损
private:
goodsaele;
shelfashelf;
administorabs;
};
//电器类默认构造函数
goods:
:
goods():
shelf()
{
name="xxx";//商品名
price=0.0;//价格
number=0;//商品数量
}
//
//仓库货架类默认构造函数
shelf:
:
shelf():
administor()
{
storeNo="xxx";//仓库编号
kinds="xxx";//商品大类
shelfNo="xxx";;//货架号
}
//仓库管理员类
administor:
:
administor()
{
name="xxx";
}
//管理类默认构造函数
manage:
:
manage():
aele(),ashelf(),abs()
{
}
charmanage:
:
homepage()
{
system("cls");
cout<cout<<<<<<<<<<<<<<<return_getch();
}
//入库
voidmanage:
:
instorage()
{
system("cls");
stringname;//商品名
doubleprice;//价格
stringstoreNo;//仓库编号
stringkinds;//商品大类
stringshelfNo;//货架号
longnumber=0;//商品数量
cout<"<cout<<"\t商品名称:
";
cin>>name;
cout<";
cin>>price;
cout<";
cin>>number;
cout<";
cin>>storeNo;
cout<";
cin>>kinds;
cout<";
cin>>shelfNo;
ofstreamstoreFile("store.txt",ios:
:
app);
storeFile<:
left)<<<<storeFile.close();
cout<system("pause");
}
//出库
voidmanage:
:
outstorage()
{
system("cls");
stringname;//商品名
cout<"<cout<<"\t商品名称:
";
cin>>name;
ifstreamstoreFile("store.txt");
if(!
storeFile)
{
ofstreamstoreFile1("store.txt");
storeFile1.close();
cout<!
!
!
"<system("pause");
return;
}
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<:
left)<<<<}
}
tempFile.close();
storeFile.close();
if(!
flag)
{
cout<!
!
"<system("pause");
return;
}
ofstreamstoreFile1("store.txt");
ifstreamtempFile1("temp.txt");
storeFile1<storeFile1.close();
tempFile1.close();
cout<!
!
"<system("pause");
}
//查询
voidmanage:
:
find()
{
while
(1)
{
system("cls");
cout<cout<<"\t============================================================="<<<"\t||||"<<<"\t||商品查询||"<<<"\t||||"<<<"\t||1.按商品名称查询||"<<<"\t||||"<<<"\t||2.按商品价格查询||"<<<"\t||||"<<<"\t||3.按大类查询||"<<<"\t||||"<<<"\t||4.返回||"<<<"\t||||"<<<"\t============================================================="<charselect=_getch();
switch(select)
{
case'1':
findname();
break;
case'2':
findprice();
break;
case'3':
findkind();
break;
case'4':
return;
default:
break;
}
}
}
//按商品名称查询
voidmanage:
:
findname()
{
system("cls");
cout<"<cout<<"\t输入商品名:
";
stringname;
cin>>name;
stringname1;//商品名
doubleprice1;//价格
stringstoreNo1;//仓库编号
stringkinds1;//商品大类
stringshelfNo1;//货架号
longcount1=0;//商品数量
ifstreamstoreFile("store.txt");
if(!
storeFile)
{
cout<!
!
"<system("pause");
return;
}
boolflag=false;
cout<<<"商品大类"<<"货架号"<while(storeFile>>name1>>price1>>count1>>storeNo1>>kinds1>>shelfNo1)
{
if(name1==name)
{
flag=true;
cout<:
left)<<<<}
}
storeFile.close();
if(!
flag)
cout<!
!
";
cout<system("pause");
}
//按商品价格查询
voidmanage:
:
findprice()
{
system("cls");
cout<"<cout<<"\t输入价格:
";
doubleprice;
cin>>price;
stringname1;//商品名
doubleprice1;//价格
stringstoreNo1;//仓库编号
stringkinds1;//商品大类
stringshelfNo1;//货架号
longcount1=0;//商品数量
ifstreamstoreFile("store.txt");
if(!
storeFile)
{
cout<!
!
"<system("pause");
return;
}
boolflag=false;
cout<<<"商品大类"<<"货架号"<while(storeFile>>name1>>price1>>count1>>storeNo1>>kinds1>>shelfNo1)
{
if(price1==price)
{
flag=true;
cout<:
left)<<<<}
}
storeFile.close();
if(!
flag)
cout<!
!
";
cout<system("pause");
}
//按大类查询
voidmanage:
:
findkind()
{
system("cls");
cout<"<cout<<"\t输入大类名:
";
stringkinds;
cin>>kinds;
stringname1;//商品名
doubleprice1;//价格
stringstoreNo1;//仓库编号
stringkinds1;//商品大类
stringshelfNo1;//货架号
longcount1=0;//商品数量
ifstreamstoreFile("store.txt");
if(!
storeFile)
{
cout<!
!
"<system("pause");
return;
}
boolflag=false;
cout<<<"商品大类"<<"货架号"<while(storeFile>>name1>>price1>>count1>>storeNo1>>kinds1>>shelfNo1)
{
if(kinds1==kinds)
{
flag=true;
cout<:
left)<<<<}
}
storeFile.close();
if(!
flag)
cout<!
!
";
cout<system("pause");
}
//商品报损
voidmanage:
:
call_break()
{
system("cls");
stringname;//商品名
cout<"<cout<<"\t商品名称:
";
cin>>name;
ifstreamstoreFile("store.txt");
if(!
storeFile)
{
ofstreamstoreFile1("store.txt");
storeFile1.close();
cout<!
!
!
"<system("pause");
return;
}
boolflag=false;
stringname1;//商品名
doubleprice1;//价格
stringkinds1;//商品大类
stringshelfNo1;//货架号
longcount1=0;//商品数量
ofstreamtempFile("temp.txt");
stringstoreNo1;//仓库编号
cout<"<<