资源简介
自己用c++实现的仓库管理系统。主要功能是实现商品的添加,插入,删除等操作。
代码片段和文件信息
#include “Manager.h“
void Manager::addin()
{
Commodity_info com_info;
cout<<“please input the name of the commodity:“< cin>>com_info.name;
cout<<“Please input the price of the commodity:“< cin>>com_info.price;
cin.clear();
cin.ignore(1024‘\n‘);
cout<<“Please input the number of the commodity:“< cin>>com_info.number;
cout<<“Please input the category of the commodity:“< cin>>com_info.category;
cout<<“Please input the production_date of the commodity:“< cin>>com_info.production_date;
cout<<“Please input the manufacturers of the commodity:“< cin>>com_info.manufacturers;
cout<<“Please input the shelf_life of the commodity:“< cin>>com_info.shelf_life;
cout<<“Please input the amount of the commodity:“< cin>>com_info.amount;
cin.clear();
cin.ignore(1024‘\n‘);
com_list.push_back(com_info);//add commodity to the commodities list.
}
void Manager::saled(string com_name)
{
//if there has no element in the commodities list.
if (!com_list.size())
{
cout<<“Warehouse is empty!“< return ;
}
Iter ite=com_list.begin();
for (;ite!=com_list.end();++ite)
{
//if find the commoditystop.elsecontinue until at the end of list.
if (ite->name==com_name)
{
break;
}
}
--(ite->amount); //decrease its amount.
if (!(ite->amount))//if its amount is 0erase the node from the list.
{
com_list.erase(ite);
cout<<“Commodity “< return ;
}
cout<<“commodity “< }
void Manager::display() const
{
if (!com_list.size())//empty
{
cout<<“Warehouse is empty!“< }
for (Con_Iter ite=com_list.begin();ite!=com_list.end();++ite)
{
//show important attributes of commodity.
cout<<“Commodity name :“<name< cout<<“Commodity price :“<price< cout<<“Commodity number :“<number< cout<<“Commodity amount :“<amount< }
}
void Manager::sellout()
{
string com_name;
cout<<“Input the name of the commodity:“< cin>>com_name;
saled(com_name);
}
void Manager::modify()
{
string com_name;
string new_data;
double new_price;
size_t new_amount;
int choice;
cout<<“Which kind of commodity do you want to modify?“< cout<<“Please input the name of the commodity:“< cin>>com_name;
Iter ite=com_list.begin();
for (;ite!=com_list.end();++ite)
{
if (ite->name==com_name)
{
for (;;)
{
modify_menu();
cin>>choice;
switch (choice)
{
case 1:
cout<<“Input the new number:“< cin>>new_data;
ite->number=new_data;
break;
case 2:
cout<<“Input the new category:“< cin>>new_data;
ite->category=new_data;
break;
case 3:
cout<<“Input the new price:“< cin>>new_price;
ite->price=new_price;
break;
case 4:
cout<<“Input the new pr
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 70144 2009-06-07 15:31 C++ source\C++仓库管理系统.doc
文件 429 2009-06-07 12:39 C++ source\source\Commodities.h
文件 2472 2009-06-06 13:53 C++ source\source\List.h
文件 6614 2009-06-08 13:09 C++ source\source\Manager.cpp
文件 950 2009-06-07 12:59 C++ source\source\Manager.h
文件 1066 2009-06-07 13:02 C++ source\source\Warehouse Management.cpp
文件 700416 2009-06-08 20:04 C++ source\Warehouse Management.exe
目录 0 2009-06-08 20:07 C++ source\source
目录 0 2009-06-08 20:08 C++ source
----------- --------- ---------- ----- ----
782091 9
评论
共有 条评论