-
大小: 803KB文件類型: .rar金幣: 2下載: 0 次發(fā)布日期: 2021-05-18
- 語言: C/C++
- 標(biāo)簽:
資源簡(jiǎn)介
銀行排隊(duì)系統(tǒng)實(shí)現(xiàn)銀行排隊(duì)功能,是C++寫的

代碼片段和文件信息
//?Bank.cpp:?implementation?of?the?Bank?class.
//
//////////////////////////////////////////////////////////////////////
#include?“stdafx.h“
#include?“Bank.h“
//////////////////////////////////////////////////////////////////////
//?Construction/Destruction
//////////////////////////////////////////////////////////////////////
Bank::Bank()
{
for?(int?i=0;?i<10;?i++)?//初始化服務(wù)窗口序號(hào)
{
window[i].SetNumber(i+1);
}
}
Bank::~Bank()
{
}
int?Bank::Rand(int?max)
{
int?ran;
srand(time(NULL));
ran?=?1?+?rand()?%?max;
return?ran;
}
void?Bank::GetNumber(int?basNum)
{
if?(basNum?==?0)
{
guest?=?new?Guest[1];
guest[0].SetNumber(1);
}
else
{
Guest?*old?=?guest;
????guest?=?new?Guest[basNum?+?1];
????for?(int?i=0;?i {
guest[i].SetNumber(i?+?1);
}
delete[]?old;
}
}
void?Bank::CallNumber(int?servied)?//參數(shù)分別為總?cè)藬?shù)及已服務(wù)人數(shù)
{
int?n?=?servied?+?1;
int?ran?=?Rand(10);
cout< // counter[ran?-?1].Serve(n);
window[ran?-?1].Serve(n);
}
void?Bank::ShowRecord()
{
FILE?*fp;
if?((fp=fopen(“record.txt““r“))?==?NULL)
{
printf?(“can?not?open?file\n“);
exit(0);
}
cout<<“?◎業(yè)務(wù)記錄總覽:“<
for?(char?c=fgetc(fp);?!feof(fp);?c=fgetc(fp))
putchar(c);
fclose(fp);
}
void?Bank::Search(int?all?int?ser)
{
char?opt;
out:cout<<“?查詢項(xiàng)目“< cout<<“≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈“?< cout<<“?1.查詢總客戶人數(shù)“< cout<<“?2.查詢待辦理業(yè)務(wù)客戶人數(shù)“< cout<<“?3.查詢今天客戶辦理業(yè)務(wù)的狀況“< cout<<“?0.返回上一級(jí)“< cout<<“≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈“?< cout<<“?請(qǐng)選擇:“;
in: cin>>opt;
switch?(opt)
{
case?‘1‘:
cout<<“?總客戶人數(shù)為:“< system(“pause“);
system(“cls“);
goto?out;
break;
case?‘2‘:
cout<<“?當(dāng)前待辦理業(yè)務(wù)客戶人數(shù)為:“< system(“pause“);
system(“cls“);
goto?out;
break;
case?‘3‘:
if?(ser?==?0)
cout<<“?尚未有任何業(yè)務(wù)記錄!“< else?
{
system(“cls“);
ShowRecord();
}
system(“pause“);
system(“cls“);
goto?out;
break;
case?‘0‘:
break;
default:
cout<<“選擇錯(cuò)誤請(qǐng)重選:“;
goto?in;
}
}
void?Bank::Work()
{
char?opt;
int?gueNum?=?0;?//顧客總數(shù)
int?serNum?=?0;?//已服務(wù)人數(shù)
out:cout<<“??**********************************************“< cout<<“??*????????????????????????????????????????????*“< cout<<“??*??????????????歡迎來到本銀行????????????????*“< cout<<“??*????????????????????????????????????????????*“< cout<<“??**********************************************“< cout< ????cout?<“??***************************“< cout?<“???業(yè)務(wù)縱覽:??????????????????“?< cout?<“???1.新顧客戶取號(hào)????????????“?< cout?<“???2.系統(tǒng)叫號(hào)????????????????“?< cout?<“???3.查看業(yè)務(wù)辦理狀況????????“?< cout?<“???4.結(jié)束程序????????????????“?< cout?<“??***************************“< cout?<“?請(qǐng)選擇:“;
in: cin>>opt;
switch?(opt)
{
case?‘1‘
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件???????3778??2009-12-18?17:29??BankSystem[X]\Bank.cpp
?????文件????????857??2009-12-18?17:58??BankSystem[X]\Bank.h
?????文件????????312??2009-12-18?14:27??BankSystem[X]\BankSystem.cpp
?????文件???????4948??2009-12-18?17:32??BankSystem[X]\BankSystem.dsp
?????文件????????545??2009-12-17?17:42??BankSystem[X]\BankSystem.dsw
?????文件??????82944??2009-12-18?18:02??BankSystem[X]\BankSystem.ncb
?????文件??????49664??2009-12-18?18:02??BankSystem[X]\BankSystem.opt
?????文件????????254??2009-12-18?18:02??BankSystem[X]\BankSystem.plg
?????文件?????199384??2009-12-18?17:58??BankSystem[X]\Debug\Bank.obj
?????文件??????????0??2009-12-18?17:58??BankSystem[X]\Debug\Bank.sbr
?????文件?????451584??2009-12-18?18:01??BankSystem[X]\Debug\BankSystem.bsc
?????文件?????577614??2009-12-18?18:01??BankSystem[X]\Debug\BankSystem.exe
?????文件?????841492??2009-12-18?18:01??BankSystem[X]\Debug\BankSystem.ilk
?????文件??????13614??2009-12-18?18:01??BankSystem[X]\Debug\BankSystem.obj
?????文件?????334800??2009-12-18?14:30??BankSystem[X]\Debug\BankSystem.pch
?????文件????1393664??2009-12-18?17:58??BankSystem[X]\Debug\BankSystem.pdb
?????文件??????????0??2009-12-18?18:01??BankSystem[X]\Debug\BankSystem.sbr
?????文件???????4327??2009-12-18?14:30??BankSystem[X]\Debug\Guest.obj
?????文件??????????0??2009-12-18?14:30??BankSystem[X]\Debug\Guest.sbr
?????文件??????92804??2009-12-18?15:26??BankSystem[X]\Debug\ounter.obj
?????文件??????????0??2009-12-18?15:26??BankSystem[X]\Debug\ounter.sbr
?????文件????????313??2009-12-18?15:45??BankSystem[X]\Debug\record.txt
?????文件???????2086??2009-12-18?14:30??BankSystem[X]\Debug\StdAfx.obj
?????文件???????4084??2009-12-18?14:30??BankSystem[X]\Debug\StdAfx.sbr
?????文件?????115712??2009-12-18?18:02??BankSystem[X]\Debug\vc60.idb
?????文件?????126976??2009-12-18?17:58??BankSystem[X]\Debug\vc60.pdb
?????文件??????92784??2009-12-18?17:57??BankSystem[X]\Debug\Window.obj
?????文件??????????0??2009-12-18?17:57??BankSystem[X]\Debug\Window.sbr
?????文件????????522??2009-12-17?20:18??BankSystem[X]\Guest.cpp
?????文件????????554??2009-12-17?17:37??BankSystem[X]\Guest.h
............此處省略11個(gè)文件信息
評(píng)論
共有 條評(píng)論