《银行业务系统源代码(共17页).docx》由会员分享,可在线阅读,更多相关《银行业务系统源代码(共17页).docx(17页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。
1、精选优质文档-倾情为你奉上#include#include#include#include#includeusing namespace std;/*窗口结构体*/struct Windowsint deposit; /*存款*/int withdrawals; /*取款*/int reportloss; /*挂失*/int borrowed; /*还贷*/int anum1000; /*保存客户*/;/*时间结构体*/struct Timeint hour;int minute;int second;/*票号结构体*/struct TicketTime arrivaltime; /*到达时间
2、*/int number; /*编号*/int business; /*办理业务*/;const int QueueSize=1000;class BankBusinsespublic:BankBusinses();void EnQueue();int GetQueue();void Personnel_Func(Ticket t2,int n,int s); /*手动业务生成函数*/int Ticket_Produce_Function(Ticket t,int n); /*打号函数*/int Personnel_Distribution_Func(int n,int flag); /*业务
3、办理函数*/int Business_statistic_Func(Windows win,int m); /*业务统计函数*/void Display_Business_Func(Windows win,int m,int n,int coordinate); /*业务显示函数*/void Make_waittime_Func(int n); /*等待时间函数*/int Menu(); /*菜单函数*/Windows win4; /*窗口*/Ticket tQueueSize; /*票*/Ticket t2QueueSize;private:string name; /*业务名称*/int
4、businesstime; /*办理业务所需时间*/int alltime; /*办理所有业务的总时间*/int waittime; /*等待时间*/double averagetime; /*平均等待时间*/long *a,*b,*v;int dataQueueSize;Ticket data2QueueSize;int front,rear;#include BankBusinses.hBankBusinses:BankBusinses()front=rear=QueueSize-1;/*打号函数*/int BankBusinses:Ticket_Produce_Function(Tick
5、et t,int n)int temp,sign,i,j=0;a=new longn;b=new longn;v=new longn;/*对时间排序*/for(i = 0;i n;i+)for(j = i+1;j tj.arrivaltime.hour)temp=ti.arrivaltime.hour;ti.arrivaltime.hour=tj.arrivaltime.hour;tj.arrivaltime.hour=temp;temp=ti.arrivaltime.minute;ti.arrivaltime.minute=tj.arrivaltime.minute;tj.arrivalti
6、me.minute=temp;temp=ti.arrivaltime.second;ti.arrivaltime.second=tj.arrivaltime.second;tj.arrivaltime.second=temp;for(i = 0;i n;i+)for(j = i+1;j tj.arrivaltime.minute)temp=ti.arrivaltime.minute;ti.arrivaltime.minute=tj.arrivaltime.minute;tj.arrivaltime.minute=temp;temp=ti.arrivaltime.second;ti.arriva
7、ltime.second=tj.arrivaltime.second;tj.arrivaltime.second=temp;else continue;for(i = 0;i n;i+)for(j = i+1;j tj.arrivaltime.second)temp=ti.arrivaltime.second;ti.arrivaltime.second=tj.arrivaltime.second;tj.arrivaltime.second=temp;else continue;for(i = 0;i n;i+)ai=vi=ti.arrivaltime.hour*3600+ti.arrivalt
8、ime.minute*60+ti.arrivaltime.second;srand(time(0);for(i = 0;i n;i+)ti.number = i; /*编号产生*/rear=(rear+1)%QueueSize;datarear=ti.number;sign = (rand()%(5-1)+1;ti.business = sign; /*业务产生*/switch(ti.business)case 1: name = 取款;businesstime = 1; break;case 2:name = 存款;businesstime = 2;break;case 3:name = 挂
9、失;businesstime = 3;break;case 4:name = 还贷;businesstime = 4;break;bi=ti.business*60;return n;/*手动业务生成客户编号函数*/void BankBusinses:EnQueue()int n,m;srand(time(0);while(front!=rear)n=(rand()%(200-1)+1);rear=(rear+1)%QueueSize;data2rear.number=n;m=(rand()%(5-1)+1;data2rear.business = m; /*业务产生*/int BankBus
10、inses:GetQueue()int i=0;while(front!=rear)front=(front+1)%QueueSize;switch(tfront.business)case 1: name = 取款;businesstime = 1; break;case 2:name = 存款;businesstime = 2;break;case 3:name = 挂失;businesstime = 3;break;case 4:name = 还贷;businesstime = 4;break;return datafront;/*处理客户业务函数*/int BankBusinses:P
11、ersonnel_Distribution_Func(int n,int flag)int i,k=-1,j=0,m=0,g=0;int transh,transm,transs,transb;long first=0,end=0,next=0,nend=0;long c4=-4,-3,-2,-1,temp; /c4作用是对应储存四个窗口业务办理结束的时间,在循环过程中后一个业务办理结束时间将修改当前结束时间Ticket_Produce_Function(t,n); /调用时间生成函数for(i=0;i4;i+)wini.withdrawals=0;wini.deposit=0;wini.re
12、portloss=0;wini.borrowed=0;c0=a0+b0; /第一个窗口结束时间初值为队列中第一个客户办理业务的结束时间waittime=b0; /第一个客户的逗留时间transh=a0/3600;transm=(a0%3600)/60;transs=(a0%3600)%60;transb=b0/60;switch(transb) /窗口各种业务累计case 1: win0.withdrawals+;businesstime = 1; break;case 2:win0.deposit+;businesstime = 2;break;case 3:win0.reportloss+
13、;businesstime = 3;break;case 4:win0.borrowed+;businesstime = 4;break;v0=0;for(i=0;in;i+) int *d;d=new int4; /动态申请长度为四的一维数组,用于存放被修改结束时间的窗口的序号flag=i;first=ai; /开始时间end=ai+bi; /结束时间nend=ai+1+bi+1; /下一个结束时间next=ai+1; /下一个开始时间for(j=0;j4;j+) /判断四个窗口中的结束时间是否大于下一个客户办理业务的开始时间if(cj=next)dj=j; /如果小于则数组的dj中保存该窗
14、口的序号elsedj=-1; /否则该地址存为-1for(j=0;j= 0)k=j; /若有则结束,55且记住该窗口序号break;elsek=-1;if(k=0)ck=nend; /如果有窗口序号被修改,则继续修改当前结束时间为下一个客户的业务办理结束时间transh=next/3600;transm=(next%3600)/60;transs=(next%3600)%60;transb=bi+1/60;waittime +=bi+1;vi+1=k;switch(transb) /窗口各种业务累计case 1: wink.withdrawals+;businesstime = 1; brea
15、k;case 2:wink.deposit+;businesstime = 2;break;case 3:wink.reportloss+;businesstime = 3;break;case 4:wink.borrowed+;businesstime = 4;break;else /如果当前窗口序号全未被修改,即当前所有窗口均处于忙碌状态,下一个客户需等待temp=c0;k=0;for(j=1;j4;j+) /找出当前所有正在办理业务的窗口中,结束时间最早的窗口if(cjtemp)temp=cj;k=j;if(temp3600*17)ck=ck+bi+1; /修改该窗口的结束时间,即下一个
16、在等待的客户到该窗口办理业务transh=next/3600;transm=(next%3600)/60;transs=(next%3600)%60;transb=bi+1/60;waittime +=temp-next+bi+1;vi+1=k;switch(transb) /窗口各种业务累计case 1: wink.withdrawals+;businesstime = 1; break;case 2:wink.deposit+;businesstime = 2;break;case 3:wink.reportloss+;businesstime = 3;break;case 4:wink.
17、borrowed+;businesstime = 4;break;else break;delete d; /每次循环结束时撤销窗口序号保存数组dj;coutendl;return flag;/*窗口业务统计函数*/int BankBusinses:Business_statistic_Func(Windows win,int m)int i,n=0,allnum=0;for(i=0;i4;i+)allnum=wini.withdrawals+wini.deposit+wini.reportloss+wini.borrowed;cout tttt 窗口 i+1;cout endl;cout 取
18、款人数t存款人数t挂失人数t还贷人数t办理业务总数;cout endl;cout wini.withdrawalsttwini.depositttwini.reportlossttwini.borrowedttallnum;cout endl;coutendl;return allnum;/*窗口业务显示函数*/void BankBusinses:Display_Business_Func(Windows win,int m,int n,int coordinate)int j,flag=1;couttttt窗口coordinate+1办理: ;coutendl;for(j=0;jn;j+)i
19、f(vj=coordinate)coutj+1号客户 t;flag=0;if(flag=1)couttt该窗口当天没有办理业务 !n;coutendl;/*等待时间函数*/void BankBusinses:Make_waittime_Func(int n)int i,flag=0;long waittime2=0;double aver=0;flag=Personnel_Distribution_Func(n,flag);couttt总人数: n;coutendl;couttt办理业务人数: flag+1;coutendl;couttt未办理完业务人数: n-flag-1;coutendl;
20、if(n-flag-1)!=0)couttt未办理完业务的编号: flag+2 n;coutendl;aver=(waittime/(flag+1)/60.0;couttt已经办理业务客户平均逗留时间: aver 分钟;coutendl;for(i=flag+2;in;i+)waittime2 +=3600*17-ai;averagetime=(waittime+waittime2)/n)/60.0;couttt当日所有客户平均逗留时间: averagetime 分钟;coutendl;/*手动业务生成函数*/void BankBusinses:Personnel_Func(Ticket t2
21、,int n,int s) int i=0,m=0; if(s)srand(time(0);t2i.arrivaltime.hour = (rand()%(17-9)+9);t2i.arrivaltime.minute = rand()%60;t2i.arrivaltime.second = rand()%60;n=(rand()%(200-1)+1);t2i.number=n;m=(rand()%(5-1)+1;t2i.business = m; /*业务产生*/switch(m)case 1: name = 取款;businesstime = 1; break;case 2:name =
22、存款;businesstime = 2;break;case 3:name = 挂失;businesstime = 3;break;case 4:name = 还贷;businesstime = 4;break;system(cls); /*清屏*cout ttn; cout ttt 中国银行ttn; cout tt n; cout tt编号ttt2i.numberttn;cout tt业务ttnamettn;cout tt到达时间: 2012/3/16 t2i.arrivaltime.hour : t2i.arrivaltime.minute : t2i.arrivaltime.second
23、tn;cout tt n; cout ttn; int BankBusinses: Menu()int m;while(m 8) system(cls);/*清屏*cout ttn; cout tt银行业务系统n; cout ttn; cout ttn; cout tt 1. 自动生成业务信息 n; cout tt 2. 显示客户逗留时间 n; cout tt 3. 显示各窗口业务统计信息 n;cout tt 4. 显示窗口业务办理信息 n;cout tt 5. 显示窗口业务办理信息 n; cout tt 6. 显示窗口业务办理信息 n;cout tt 7. 显示窗口业务办理信息 n; cou
24、t tt 8. 手动生成业务 n; cout tt 0. 退出程序 n; cout ttn; cout m,!cin.eof() /流控制语句,判断变量输入是否是整型if(!cin.good() /如果不是整型则重新输入cin.clear();cin.ignore();couttt输入错误 !ntt请重新输入!;Sleep(5000); /暂停1秒 返回菜单重新输入return m;else if(m8)cout=0 & m=8) )break;return m; #include BankBusinses.hint main()int i,n,m,flag=0;BankBusinses C;
25、while(1) switch(C.Menu()case 1:srand(time(0);n=(rand()%(500-1)+1);for(i = 0;i n;i+)C.ti.arrivaltime.hour = (rand()%(17-9)+9);C.ti.arrivaltime.minute = rand()%60;C.ti.arrivaltime.second = rand()%60;C.Ticket_Produce_Function(C.t,n);C.EnQueue();C.GetQueue();C.Personnel_Distribution_Func(n,0);flag=1;cou
26、ttt业务信息生成成功 !n;system(pause); break;case 2:if(flag=0)couttt无可查询信息 !n;elseC.Make_waittime_Func(n);system(pause);break;case 3:if(flag=0)couttt无可查询信息 !n;elseC.Business_statistic_Func(C.win,4);system(pause);break;case 4:if(flag=0)couttt无可查询信息 !n;elseC.Display_Business_Func(C.win,4,n,0);system(pause);bre
27、ak;case 5:if(flag=0)couttt无可查询信息 !n;elseC.Display_Business_Func(C.win,4,n,1);system(pause);break;case 6:if(flag=0)couttt无可查询信息 !n;elseC.Display_Business_Func(C.win,4,n,2);system(pause);break;case 7:if(flag=0)couttt无可查询信息 !n;elseC.Display_Business_Func(C.win,4,n,3);system(pause);break;case 8:system(cls); /*清屏*for(i=0;iQueueSize;i+)cout ttn; cout tt是否打号?(1/0)