-
大小: 1.04MB文件類型: .rar金幣: 2下載: 0 次發(fā)布日期: 2023-09-02
- 語言: C/C++
- 標(biāo)簽:
資源簡介
1系統(tǒng)概述
1.1設(shè)計(jì)題目
超市收銀管理系統(tǒng)
1.2可行性分析
1.2.1背景
超市是一個很繁忙的地方,每天有很多的顧客要買東西,收銀員要和很多的顧客結(jié)算,并且要給這些結(jié)算存檔,以便日后查看。如果只用人工的方法去處理這些結(jié)算和計(jì)算的數(shù)據(jù)將是一件很繁瑣的事情,將投入大量的人力物力,為了解決這個問題,實(shí)現(xiàn)科學(xué)化、現(xiàn)代化的超市收銀管理,我們就必須設(shè)計(jì)開發(fā)超市收銀系統(tǒng),并用于實(shí)踐。
而超市收銀管理系統(tǒng)是對超市的收款信息進(jìn)行管理的計(jì)算機(jī)網(wǎng)絡(luò)軟件系統(tǒng),它可完成超市中各種貨品的收銀工作,并對可以對特定時間段的出售信息進(jìn)行查詢。

代碼片段和文件信息
//?counter.cpp:?implementation?of?the?supermarket?class.
//
//////////////////////////////////////////////////////////////////////
#include?“counter.h“
#include?
//************************************************************************
//*商品類的成員函數(shù)定義
//************************************************************************
CGoods::CGoods(?int?iIndex?string?strName?double?dUnitPrice?)
{
//?初始化商品
m_iIndex?????=?iIndex;
m_strName????=?strName;
m_dUnitPrice?=?dUnitPrice;
}
CGoods::~CGoods()
{
}
//attributes?and?operations
int?CGoods::GetIndex(void)?const?{
return?m_iIndex;
}
string?CGoods::GetName(void)?const{
return?m_strName;
}
double?CGoods::GetUnitPrice(void)?const?{
return?m_dUnitPrice;
}
void?CGoods::SetUnitPrice(double?dUnitPrice){
m_dUnitPrice?=?dUnitPrice;
}
CGoods?*CGoods::Clone(){
return?new?CGoods(m_iIndex?m_strName?m_dUnitPrice);
}
//************************************************************************
//*商品類的成員函數(shù)定義結(jié)束
//************************************************************************
//************************************************************************
//*儲藏室類的成員函數(shù)定義
//************************************************************************
CStore::CStore()
{
}
CStore::~CStore()
{
DeleteAllGoods();
}
//往儲藏室種添加貨物
bool?CStore::AddGoods(CGoods?*pGoods?int?iNum){
assert(?pGoods?!=?NULL?);
int?size?=?m_vStore.size();
bool?bIsExist?=?false;
for(int?i=0;?i PSTOREELEMENT?pSE?=?m_vStore[i];
assert(pSE?!=?NULL);
//假如已經(jīng)有了同類商品在儲藏室,那么增加此商品的數(shù)目
if?(?pSE->pGoods?!=?NULL?&&?pSE->pGoods->GetIndex()?==?pGoods->GetIndex()?){
bIsExist?=?true;
pSE->iNum?+=?iNum?;
????????????break;
}
}
//儲藏室沒有同類商品,直接增加此類商品
if?(?!bIsExist?){
PSTOREELEMENT?p?=?new?STOREELEMENT;
p->pGoods???????=?pGoods;
p->iNum?????????=?iNum;
m_vStore.push_back(?p?);?
}
return?true;
}
//清空整個儲藏室
void?CStore::DeleteAllGoods(){
int?size?=?m_vStore.size();
for(int?i=0;?i PSTOREELEMENT?pSE?=?m_vStore[i];
assert(pSE?!=?NULL);
if?(?pSE->pGoods?!=?NULL?){
delete?pSE->pGoods;??//刪除商品
pSE->pGoods?=?NULL;
}
delete?pSE;??????????????//刪除儲藏室元素
pSE????=?NULL;
}
}
//刪除名為strName的貨物,iNum為刪除數(shù)量
int??CStore::DeleteGoods(const?string?&strName?int?iNum){
int?size?=?m_vStore.size();
for(int?i=0;?i PSTOREELEMENT?pSE?=?m_vStore[i];
assert(pSE?!=?NULL);
if?(?pSE->pGoods?!=?NULL?&&?pSE->pGoods->GetName()?==?strName?){
if?(?iNum?<=?-1?||?pSE->iNum?<=?iNum){
delete?pSE->pGoods;
pSE->iNum?=?0;
delete?pSE;??????????????//刪除儲藏室元素
pSE????=?NULL;
return?0;
}
else{
pSE->iNum?-=?iNum;
return?pSE->iNum;
}
}
}
return?0;
}
//刪除索引號為iIndex的貨物,iNum為刪除數(shù)量
int?CStore::DeleteGoods(int?iIndex?int?iNum){
int?size?=?m_vStore.size();
for(int?i=0;?i PSTOREELEMENT?pSE?=?m_vS
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
????..A.SH.?????????9??2006-09-17?18:40??案例16_超市收銀系統(tǒng)\_desktop.ini
?????文件???????6668??2006-09-25?15:10??案例16_超市收銀系統(tǒng)\Example_Supermarket\counter.cpp
?????文件???????2713??2006-09-25?15:11??案例16_超市收銀系統(tǒng)\Example_Supermarket\counter.h
?????文件???????4551??2006-09-18?20:51??案例16_超市收銀系統(tǒng)\Example_Supermarket\Example_Supermarket.dsp
?????文件????????561??2006-09-18?20:35??案例16_超市收銀系統(tǒng)\Example_Supermarket\Example_Supermarket.dsw
?????文件??????66560??2007-01-07?09:59??案例16_超市收銀系統(tǒng)\Example_Supermarket\Example_Supermarket.ncb
?????文件??????48640??2007-01-07?09:59??案例16_超市收銀系統(tǒng)\Example_Supermarket\Example_Supermarket.opt
?????文件????????272??2006-09-28?21:59??案例16_超市收銀系統(tǒng)\Example_Supermarket\Example_Supermarket.plg
?????文件???????4150??2006-09-18?14:42??案例16_超市收銀系統(tǒng)\Example_Supermarket\main.cpp
?????文件?????213176??2006-09-25?15:10??案例16_超市收銀系統(tǒng)\Example_Supermarket\Debug\counter.obj
?????文件?????589946??2006-09-25?15:10??案例16_超市收銀系統(tǒng)\Example_Supermarket\Debug\Example_Supermarket.exe
?????文件?????847904??2006-09-25?15:10??案例16_超市收銀系統(tǒng)\Example_Supermarket\Debug\Example_Supermarket.ilk
?????文件????2381268??2006-09-25?15:08??案例16_超市收銀系統(tǒng)\Example_Supermarket\Debug\Example_Supermarket.pch
?????文件????1401856??2006-09-25?15:10??案例16_超市收銀系統(tǒng)\Example_Supermarket\Debug\Example_Supermarket.pdb
?????文件?????282533??2006-09-25?15:08??案例16_超市收銀系統(tǒng)\Example_Supermarket\Debug\main.obj
?????文件?????115712??2007-01-07?09:57??案例16_超市收銀系統(tǒng)\Example_Supermarket\Debug\vc60.idb
?????文件?????143360??2006-09-25?15:10??案例16_超市收銀系統(tǒng)\Example_Supermarket\Debug\vc60.pdb
?????目錄??????????0??2008-12-07?17:44??案例16_超市收銀系統(tǒng)\Example_Supermarket\Debug
?????目錄??????????0??2008-12-07?17:44??案例16_超市收銀系統(tǒng)\Example_Supermarket
?????目錄??????????0??2008-12-07?17:44??案例16_超市收銀系統(tǒng)
-----------?---------??----------?-----??----
??????????????6109879????????????????????20
評論
共有 條評論