資源簡介
銀行排隊系統實現銀行排隊功能,是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++)?//初始化服務窗口序號
{
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)?//參數分別為總人數及已服務人數
{
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<<“?◎業務記錄總覽:“<
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<<“?查詢項目“< cout<<“≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈“?< cout<<“?1.查詢總客戶人數“< cout<<“?2.查詢待辦理業務客戶人數“< cout<<“?3.查詢今天客戶辦理業務的狀況“< cout<<“?0.返回上一級“< cout<<“≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈≈“?< cout<<“?請選擇:“;
in: cin>>opt;
switch?(opt)
{
case?‘1‘:
cout<<“?總客戶人數為:“< system(“pause“);
system(“cls“);
goto?out;
break;
case?‘2‘:
cout<<“?當前待辦理業務客戶人數為:“< system(“pause“);
system(“cls“);
goto?out;
break;
case?‘3‘:
if?(ser?==?0)
cout<<“?尚未有任何業務記錄!“< else?
{
system(“cls“);
ShowRecord();
}
system(“pause“);
system(“cls“);
goto?out;
break;
case?‘0‘:
break;
default:
cout<<“選擇錯誤請重選:“;
goto?in;
}
}
void?Bank::Work()
{
char?opt;
int?gueNum?=?0;?//顧客總數
int?serNum?=?0;?//已服務人數
out:cout<<“??**********************************************“< cout<<“??*????????????????????????????????????????????*“< cout<<“??*??????????????歡迎來到本銀行????????????????*“< cout<<“??*????????????????????????????????????????????*“< cout<<“??**********************************************“< cout< ????cout?<“??***************************“< cout?<“???業務縱覽:??????????????????“?< cout?<“???1.新顧客戶取號????????????“?< cout?<“???2.系統叫號????????????????“?< cout?<“???3.查看業務辦理狀況????????“?< cout?<“???4.結束程序????????????????“?< cout?<“??***************************“< cout?<“?請選擇:“;
in: cin>>opt;
switch?(opt)
{
case?‘1‘
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????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個文件信息
- 上一篇:AGC的算法DSP上的
- 下一篇:linux下C語言實現讀者寫者寫者優先
評論
共有 條評論