目录
一、需求分析 ..............................................................................................................
二、程序的主要功能 ..................................................................................................
三、程序运行平台 ......................................................................................................
四、系统总框架图 ......................................................................................................
五、程序类的说明 ......................................................................................................
六、模块分析 ..............................................................................................................
七、比较有特色的函数 ..............................................................................................
八、存在的不足与对策 ..............................................................................................
九、程序源代码 ..........................................................................................................
一、需求分析
设计商场库存管理系统。此程序是为了更好的处理货物的详细信息。包括货物的入库、出库、查询、统计。并且能够很好的让使用者了解库存货物的有关信息。
系统要求能够按编号显示、查找、增加、删除、和保存各类货物的信息。输入和输出货物的有关信息并且对输入保存文件里确定程序至少具备以下功能:查询模块、增加模块、删除模块、货物的有关信息数据存盘等的基本模块。
系统具有“货物的有关信息数据存盘”的功能,所以货物的有关信息数据可以保存到磁盘文件,那么也就意味着今后可以从磁盘文件读出货物的有关信息,可以方便用户使用,避免数据重复录入,考虑到系统实现简洁,货物数据文件采用文本文件,货物数据文件名:date.dat。
作为一个完整的系统,除了具有增加货物,删除货物的信息模块,还应该具有修改货物相关信息的功能,所以本系统具备了“商品入库”、“商品出库”、“查询统计”、“商品报损”、“退出系统”,这5个基本功能,就可以以最简捷的方式实现对货物的管理,也就实现了系统的要求。
二、程序的主要功能
char first_face();//首页
void in_storage();//入库
void out_storage();// 出库
void select_ele();//查询
void select_name();//按商品名称查询
void select_price();//按商品价格查询
void select_kind();//按大类查询
void call_break();//商品报损
三、程序运行平台
Dev c++
四、系统总框架图
五、程序类的说明
1.主要类说明:
使用面向对象的程序设计进行分析,整个系统涉及两大类可操作,仓库、商品。所以系统主要涉及两大类:仓库类、商品类。系统框架就是仓库类和商品类的定义;主函数中定义一个仓库对象,循环显示主菜单并根据用户选择调用仓库类的相应方法(成员函数)。
考虑系统操作的货物信息具有不确定性,所以考虑使用链表保存、处理货物信息。仓库类包含:所有货物信息的一个不带头结点的链表及可以对货物信息进行增,改,删除,查询,数量设置,数据存盘等操作的相关模块为成员函数。所有货物都具有的公共信息及操作可以使用仓库类进行描述。由于系统具有3类货物且3类货物信息数据,操作基本相同,所以可以为他们创立相同的类,并且采用继承和派生。
2.系统采用的关键(难点)技术:
a.仓库管理员类
class admin
{
public:
admin();
private:
string name;
};
b.仓库货架类
class shelf
{
public:
shelf();
private:
admin men;//管理员
string storeNo;//仓库编号
string kinds;//商品大类
string shelfNo;//货架号
};
六、模块分析
1.//入库
void mana::in_storage()
{......
cout
......
ofstream storeFile("store.txt", ios::app);
storeFile
storeFile.close();
cout
system("pause");
}
2.//出库
void mana::out_storage()
{
system("cls");
string name;//商品名
cout
cout
cin >> name;
ifstream storeFile("store.txt");
if(!storeFile)
{ofstream storeFile1("store.txt");
storeFile1.close();
cout
system("pause");
return;
}
bool flag=false;//标准位
......
ofstream tempFile("temp.txt"); //临时文件
while(storeFile>>name1>>price1>>count1>>storeNo1>>kinds1>>shelfNo1)
{
if(name1==name)
flag=true;
else
{
tempFile
}
}
tempFile.close();
storeFile.close();
if(!flag)
{
cout
system("pause");
return;
}
ofstream storeFile1("store.txt");
ifstream tempFile1("temp.txt");
storeFile1
tempFile1.close();
cout
}
3.以名称查询为例
void mana::select_name()//按商品名称查询
{
system("cls");
string name;
cout
......
ifstream storeFile("store.txt");
if (!storeFile)
{
cout
system("pause");
return;
}
bool flag=false;
cout
while(storeFile>>name1>>price1>>count1>>storeNo1>>kinds1>>shelfNo1)
{
if(name1==name)
{
flag=true;
cout
}
}
storeFile.close();
if(!flag)
cout
cout
system("pause");
}
4.//商品报损
void mana::call_break()
{
system("cls");
string name;//商品名
cout
cout
cin>>name;
ifstream storeFile("store.txt");
if(!storeFile)
{
ofstream storeFile1("store.txt");
storeFile1.close();
cout
system("pause");
return;
}
bool flag=false;
string name1;//商品名
double price1;//价格
string kinds1;//商品大类
string shelfNo1;//货架号
long count1=0; //商品数量
string storeNo1;//仓库编号
ofstream tempFile("temp.txt");
cout
cout
while(storeFile>>name1>>price1>>count1>>storeNo1>>kinds1>>shelfNo1)
{
if(name1==name)
{
flag = true;
cout
shelfNo1+="(损坏)";
}
tempFile
}
tempFile.close();
storeFile.close();
if (!flag)
{
cout
system("pause");
return;
}
ofstream storeFile1("store.txt");
ifstream tempFile1("temp.txt");
storeFile1
storeFile1.close();
tempFile1.close();
cout
system("pause");
}
七、比较有特色的函数
//商品报损
void mana::call_break()
{
system("cls");
string name;//商品名
cout
cout
cin>>name;
ifstream storeFile("store.txt");
if(!storeFile)
{
ofstream storeFile1("store.txt");
storeFile1.close();
cout
system("pause");
return;
}
bool flag=false;
string name1;//商品名
double price1;//价格
string kinds1;//商品大类
string shelfNo1;//货架号
long count1=0; //商品数量
string storeNo1;//仓库编号
ofstream tempFile("temp.txt");
cout
cout
while(storeFile>>name1>>price1>>count1>>storeNo1>>kinds1>>shelfNo1)
{
if(name1==name)
{
flag = true;
cout
shelfNo1+="(损坏)";
}
tempFile
}
tempFile.close();
storeFile.close();
if (!flag)
{
cout
system("pause");
return;
}
ofstream storeFile1("store.txt");
ifstream tempFile1("temp.txt");
storeFile1
storeFile1.close();
tempFile1.close();
cout
cout
system("pause");
}
八、存在的不足与对策
由于现在编程水平有限,该系统的功能比较简单,查错能力也不强,对于一些不正确的输入可能会造成一些难以预料的结果,这些不足请老师多多谅解。今后会更多的学习编程技巧,不断的提高程序设计水平,掌握类的构造方法,明确类中构造函数、成员函数的建立以及调用,并且结合C++中字符串函数的编译系统给定的库函数,采用一定的逻辑编译,实现题目中要求的各项要求,达到基本实验目的,提高自己的C++语言使用水平。
源代码可以免费加Q473479100获取。
目录
一、需求分析 ..............................................................................................................
二、程序的主要功能 ..................................................................................................
三、程序运行平台 ......................................................................................................
四、系统总框架图 ......................................................................................................
五、程序类的说明 ......................................................................................................
六、模块分析 ..............................................................................................................
七、比较有特色的函数 ..............................................................................................
八、存在的不足与对策 ..............................................................................................
九、程序源代码 ..........................................................................................................
一、需求分析
设计商场库存管理系统。此程序是为了更好的处理货物的详细信息。包括货物的入库、出库、查询、统计。并且能够很好的让使用者了解库存货物的有关信息。
系统要求能够按编号显示、查找、增加、删除、和保存各类货物的信息。输入和输出货物的有关信息并且对输入保存文件里确定程序至少具备以下功能:查询模块、增加模块、删除模块、货物的有关信息数据存盘等的基本模块。
系统具有“货物的有关信息数据存盘”的功能,所以货物的有关信息数据可以保存到磁盘文件,那么也就意味着今后可以从磁盘文件读出货物的有关信息,可以方便用户使用,避免数据重复录入,考虑到系统实现简洁,货物数据文件采用文本文件,货物数据文件名:date.dat。
作为一个完整的系统,除了具有增加货物,删除货物的信息模块,还应该具有修改货物相关信息的功能,所以本系统具备了“商品入库”、“商品出库”、“查询统计”、“商品报损”、“退出系统”,这5个基本功能,就可以以最简捷的方式实现对货物的管理,也就实现了系统的要求。
二、程序的主要功能
char first_face();//首页
void in_storage();//入库
void out_storage();// 出库
void select_ele();//查询
void select_name();//按商品名称查询
void select_price();//按商品价格查询
void select_kind();//按大类查询
void call_break();//商品报损
三、程序运行平台
Dev c++
四、系统总框架图
五、程序类的说明
1.主要类说明:
使用面向对象的程序设计进行分析,整个系统涉及两大类可操作,仓库、商品。所以系统主要涉及两大类:仓库类、商品类。系统框架就是仓库类和商品类的定义;主函数中定义一个仓库对象,循环显示主菜单并根据用户选择调用仓库类的相应方法(成员函数)。
考虑系统操作的货物信息具有不确定性,所以考虑使用链表保存、处理货物信息。仓库类包含:所有货物信息的一个不带头结点的链表及可以对货物信息进行增,改,删除,查询,数量设置,数据存盘等操作的相关模块为成员函数。所有货物都具有的公共信息及操作可以使用仓库类进行描述。由于系统具有3类货物且3类货物信息数据,操作基本相同,所以可以为他们创立相同的类,并且采用继承和派生。
2.系统采用的关键(难点)技术:
a.仓库管理员类
class admin
{
public:
admin();
private:
string name;
};
b.仓库货架类
class shelf
{
public:
shelf();
private:
admin men;//管理员
string storeNo;//仓库编号
string kinds;//商品大类
string shelfNo;//货架号
};
六、模块分析
1.//入库
void mana::in_storage()
{......
cout
......
ofstream storeFile("store.txt", ios::app);
storeFile
storeFile.close();
cout
system("pause");
}
2.//出库
void mana::out_storage()
{
system("cls");
string name;//商品名
cout
cout
cin >> name;
ifstream storeFile("store.txt");
if(!storeFile)
{ofstream storeFile1("store.txt");
storeFile1.close();
cout
system("pause");
return;
}
bool flag=false;//标准位
......
ofstream tempFile("temp.txt"); //临时文件
while(storeFile>>name1>>price1>>count1>>storeNo1>>kinds1>>shelfNo1)
{
if(name1==name)
flag=true;
else
{
tempFile
}
}
tempFile.close();
storeFile.close();
if(!flag)
{
cout
system("pause");
return;
}
ofstream storeFile1("store.txt");
ifstream tempFile1("temp.txt");
storeFile1
tempFile1.close();
cout
}
3.以名称查询为例
void mana::select_name()//按商品名称查询
{
system("cls");
string name;
cout
......
ifstream storeFile("store.txt");
if (!storeFile)
{
cout
system("pause");
return;
}
bool flag=false;
cout
while(storeFile>>name1>>price1>>count1>>storeNo1>>kinds1>>shelfNo1)
{
if(name1==name)
{
flag=true;
cout
}
}
storeFile.close();
if(!flag)
cout
cout
system("pause");
}
4.//商品报损
void mana::call_break()
{
system("cls");
string name;//商品名
cout
cout
cin>>name;
ifstream storeFile("store.txt");
if(!storeFile)
{
ofstream storeFile1("store.txt");
storeFile1.close();
cout
system("pause");
return;
}
bool flag=false;
string name1;//商品名
double price1;//价格
string kinds1;//商品大类
string shelfNo1;//货架号
long count1=0; //商品数量
string storeNo1;//仓库编号
ofstream tempFile("temp.txt");
cout
cout
while(storeFile>>name1>>price1>>count1>>storeNo1>>kinds1>>shelfNo1)
{
if(name1==name)
{
flag = true;
cout
shelfNo1+="(损坏)";
}
tempFile
}
tempFile.close();
storeFile.close();
if (!flag)
{
cout
system("pause");
return;
}
ofstream storeFile1("store.txt");
ifstream tempFile1("temp.txt");
storeFile1
storeFile1.close();
tempFile1.close();
cout
system("pause");
}
七、比较有特色的函数
//商品报损
void mana::call_break()
{
system("cls");
string name;//商品名
cout
cout
cin>>name;
ifstream storeFile("store.txt");
if(!storeFile)
{
ofstream storeFile1("store.txt");
storeFile1.close();
cout
system("pause");
return;
}
bool flag=false;
string name1;//商品名
double price1;//价格
string kinds1;//商品大类
string shelfNo1;//货架号
long count1=0; //商品数量
string storeNo1;//仓库编号
ofstream tempFile("temp.txt");
cout
cout
while(storeFile>>name1>>price1>>count1>>storeNo1>>kinds1>>shelfNo1)
{
if(name1==name)
{
flag = true;
cout
shelfNo1+="(损坏)";
}
tempFile
}
tempFile.close();
storeFile.close();
if (!flag)
{
cout
system("pause");
return;
}
ofstream storeFile1("store.txt");
ifstream tempFile1("temp.txt");
storeFile1
storeFile1.close();
tempFile1.close();
cout
cout
system("pause");
}
八、存在的不足与对策
由于现在编程水平有限,该系统的功能比较简单,查错能力也不强,对于一些不正确的输入可能会造成一些难以预料的结果,这些不足请老师多多谅解。今后会更多的学习编程技巧,不断的提高程序设计水平,掌握类的构造方法,明确类中构造函数、成员函数的建立以及调用,并且结合C++中字符串函数的编译系统给定的库函数,采用一定的逻辑编译,实现题目中要求的各项要求,达到基本实验目的,提高自己的C++语言使用水平。
源代码可以免费加Q473479100获取。