




已阅读5页,还剩7页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
#include#include#include#include using namespace std;const int aa=70,bb=150,cc=130,dd=50;/不同业务所需时间struct data/客户资料int usetime;/客户在银行时间int bianhao;/客户编号int yewutime;/客户所办业务时间string yewu;/业务名int yewunum;/业务标号int chutime3;/客户到达时间,chutime0是秒钟,chutime1是分钟,chutime2是时钟int motime3;/客户离开时间int windownum;class Bankprivate:int windowsum45; /窗口数long sumtime; /所有办理完业务客户总共所用时间int suijitime; /最后两个客户间隔时间int stilltime4; /每个窗口还需等待时间int s,f,m; /分别是时、分、秒int wind5; /wind0是空闲窗口数量,wind1/2/3/4存放具体窗口名public:Bank(); /初始化data kehu900; /8小时内最多客户人数void timelocal(Bank &); /记录时间int windows(int,int); /为客户排队void calculatechu(int,Bank&);/记录客户到达时间void print(int,int ,Bank); /输出客户数据void averagetime(int,Bank); /计算平均时间void window_dail(); /输出窗口信息int fanhui(Bank &); /求随机时间void custerm_dail(int,int,Bank);/选择客户编号void choose(int,int,Bank); /选择查看内容void todaynum(int,int,Bank);/显示今日客户量void writetotext(int,Bank);/文件函数操作;Bank:Bank()/构造s=8;/时间f=0;m=0;suijitime=0; /随机间隔时间sumtime=0; /所有客户在银行所用时间之和for(int i=0;i4;i+)stilltimei=0; /每个窗口处理剩下业务还需要的时间for(int j=0;j5;j+)windowsumij=0; /每个窗口处理客户数for(int a=0;a=1) /完成时间格式m=m-60;f+;while(f/60=1)f=f-60;s+;return s;void Bank:timelocal(Bank &wait) /记录银行时间cout您到达的时间是: ;if(s10)cout0s:;/特定格式输出else couts:;if(f10)cout0f:;else coutf:;if(m10)cout0mendl;else coutmendl;void Bank:averagetime(int x,Bank wait)/计算所有客户的平均等待时间long aver=0;/平均时间int fen=0,miao=0;/平均时间以分、秒表示int j;sumtime=0;for(j=0;jx;j+)sumtime=sumtime+wait.kehuj.usetime;/总共时间aver=sumtime/(x);/计算fen=aver/60;miao=aver;cout所有客户平均等待了 fen分miao秒!endlendl;/求空窗口数int Bank:windows(int x,int i)/x是办理业务的客户数,i是最后一位顾客的编号,wait是主函数里定义的对象int a,b=1,t=0;for(a=0;a5;a+)/初始化窗口空闲信息winda=0;for(a=0;a4;a+)stilltimea=stilltimea-suijitime;/特定窗口处理还需的时间等于上次处理所需的时间减去随机等待时间if(stilltimea=0) /如果时间为负,重新赋值stilltimea=0;wind0+; /空余窗口数windb+=a+1; /指出特定的空闲窗口t=wind0;b=1;while(x0) /窗口不空stilltimewindb-1=stilltimewindb-1+kehux.yewutime;/特定窗口处理完业务所需时间等于 处理完上次业务所需时间 加上 此次业务时间kehux.motime0=m;/客户离开时的秒钟kehux.motime1=f;/客户离开时的分钟kehux.motime2=s;/客户离开时的时钟kehux.usetime=kehux.motime0-kehux.chutime0+(kehux.motime1-kehux.chutime1)*60+(kehux.motime2-kehux.chutime2)*3600+kehux.yewutime;/客户在银行等待时间windowsumwindb-10+;/特定窗口处理的客户数windowsumwindb-1kehux.yewunum+; /特定窗口处理的业务数b+;x+;t-;return x;void Bank:calculatechu(int i,Bank &Custerm)/客户的到达时间int j;for(j=0;j=60)sec=sec-60;min+;while(min=60)min=min-60;hour+;cout以下是Custerm.kehux.bianhao号客户的详细资料:endl;cout选择的业务:Custerm.kehux.yewuendl;cout选择的业务所需的时间:Custerm.kehux.yewutimeendl;cout0;k-)if(Custerm.kehux.chutimek10)cout0Custerm.kehux.chutimek:;else coutCusterm.kehux.chutimek:;if(Custerm.kehux.chutime010)cout0Custerm.kehux.chutime0;else coutCusterm.kehux.chutime0;coutendl;cout客户离开的时间:;if(hour10)cout0hour:;/特定格式输出else couthour:;if(min10)cout0min:;else coutmin:;if(sec10)cout0secendl;else coutsecendl;coutendl;void Bank:window_dail()/输出窗口办理业务的情况int i;while(1)cout请选择窗口(1-4),以0结束:i;if(i=0)system(cls);break;if(i=5)system(cls);cout没有这个窗口,请重新选择endl;elsesystem(cls);cout i窗口共处理了 windowsumi-10人endl;cout其中endl;cout 存款业务 windowsumi-11人endl;cout 取款业务 windowsumi-12人endl;cout 挂失业务 windowsumi-13人endl;cout 还贷业务 windowsumi-14人endl;void Bank:todaynum(int x,int i,Bank Custerm)/输出客户量coutendl 今日共来了i位客户!endl;cout 其中,处理了x位客户,还有i-x位客户未得到处理!endlendl;void Bank:custerm_dail(int i,int x,Bank Custerm)/选择输出的客户编号int h;while(1)couth;if(h=0)couti)system(cls);cout没有这个编号,请重新选择!endlx&hi)system(cls);cout银行停业前未处理该客户!endlendl;else system(cls);print(h-1,i,Custerm);void Bank:choose(int x,int i,Bank Custerm)/选择输出详细信息int n;int flag=0;while(1)cout endl;coutendl;cout 0 退出 endlendl;cout 1 查看今日银行客户数量 endlendl;cout 2 第n号窗口的详细信息 endlendl;cout 3 客户平均等待时间 endlendl;coutendl;cout endlendl;coutn;switch(n)case 0:flag=1;break;case 1:system(cls);todaynum(x,i,Custerm);system(pause);system(cls);break;case 2:system(cls);window_dail();break;/ case 3:system(cls);custerm_dail(i,x,Custerm) ;break;case 3:system(cls);averagetime(x,Custerm);system(pause);system(cls);break;default:system(cls);cout没有这个选项,请重新选择!=60)sec=sec-60;min+;while(min=60)min=min-60;hour+;coutch;if(ch=y)if(x=0)cout数据记录为空!endl;elseofstream outfile(f1.txt,ios:out);if(!outfile)cout打开失败endl;exit(1);while(jx)outfile * * * * * * * * * * endl;outfile 客户编号: kehuj.bianhaoendl;outfile 办理业务: kehuj.yewuendl;outfile 业务时间: kehuj.yewutimeendl;outfile 到达时间: ;if(kehuj.chutime210)outfile0kehuj.chutime2:;else outfilekehuj.chutime2:;if(kehuj.chutime110)outfile0kehuj.chutime1:;else outfilekehuj.chutime1:;if(kehuj.chutime010)outfile0kehuj.chutime0:endl;else outfilekehuj.chutime0:endl;outfile=60)sec=sec-60;min+;while(min=60)min=min-60;hour+;if(hour10)outfile0hour:;else outfilehour:;if(min10)outfile0min:;else outfilemin:;if(sec10)outfile0sec:endl;else outfilesec:endl;j+;outfile.close();cout成功生成文件!endl;int main ()int ff;time_t t = time(0); /时间函数char tmp64;int x=0,i=0; /i是最后到的客户编号int flag1=1,flag=1,flag2=1; /x排在最前面的客户编号,flag1是第一次选项的关键标志,flag标志int s=8; /16:00之前营业,s是时钟,m是最后两位客户间隔时间int ch;Bank Custerm;string a=存款,b=取款,c=挂失,d=还贷;/业务名while(flag1)coutendl;cout endl;coutendl;cout 0:退出 endl;cout 1:随机结果 endl;cout 2:输入业务 endl;cout 3:从文件读入endl;cout endl;cout 请选择: ;scanf(%d,&ch);switch(ch)case 0:exit(0);case 1:flag=0;/选择是否使用系统暂停函数flag1=0;/停止本项选择break;case 2:flag1=0;break;/*case 3:flag1=0;break;*/default:cout 没有这个选项,请重新选择!endl;system(pause);break;system(cls);while(s)coutendl;coutendl;cout endl;coutendl;cout endl;cout 欢迎来到小辉辉银行 endl;cout endl;cout endl;cout 1:存 款 endl;cout 2:取 款 endl;cout 3:挂 失 endl;cout 4:还 贷 endl;cout 0:退 出 endl;coutendl;cout ff;elseff=(rand()%4+1);/随机选择4种业务switch(ff)case 0:system(cls);break;case 1:coutendl;cout* * * * * * * * * * * * * * * =16)flag2=0;break;Custerm.kehui.bianhao=i+1;/赋值编号Custerm.kehui.yewu=a;/赋值业务名Custerm.kehui.yewunum=1;/赋值业务编号Custerm.kehui.yewutime=aa;/赋值业务所用时间Custerm.timelocal(Custerm);/16:00之前营业,s是时钟Custerm.calculatechu(i,Custerm);/计算到达时间x=Custerm.windows(x,i);/x是排在前面的顾客编号i+;coutendl您的号码是: i 办理的是: aendlendl;cout您前面还有i-x位客户endlendl;break;case 2:coutendl;cout* * * * * * * * * * * * * * * =16)flag2=0;break;Custerm.kehui.bianhao=i+1;Custerm.kehui.yewu=b;Custerm.kehui.yewunum=2;Custerm.kehui.yewutime=bb;Custerm.timelocal(Custerm);Custerm.calculatechu(i,Custerm);x=Custerm.windows(x,i);i+;coutendl您的号码是: i 办理的是: bendlendl;cout您前面还有i-x位客户endlendl;break;case 3:coutendl;cout* * * * * * * * * * * * * * * =16)flag2=0;break;Custerm.kehui.bianhao=i+1;C
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 河南质量工程职业学院《幼儿美术创作》2023-2024学年第一学期期末试卷
- 烟台南山学院《工科数学分析(I)》2023-2024学年第一学期期末试卷
- 湖北省天门市六校2024-2025学年九年级化学第一学期期末联考试题含解析
- 四川省成都市嘉祥外国语学校2024年八年级物理第一学期期末检测模拟试题含解析
- 河南省邓州市张村乡中学2025届七年级数学第一学期期末经典试题含解析
- 江苏省大丰市新丰中学2025年物理高二第二学期期末复习检测模拟试题含解析
- 广西壮族自治区桂林市2025届物理高二下期末达标检测模拟试题含解析
- 2025届江西省宜春市上高县第二中学高二物理第二学期期末联考试题含解析
- 2025届北京市北方交大附中高一物理第二学期期末复习检测试题含解析
- 黑龙江省大庆市重点初中2025届物理高二下期末复习检测试题含解析
- 2024四川广元市检察机关招聘聘用制书记员22人笔试备考题库及答案解析
- 二维材料在柔性电子中的应用研究
- 内科患者VTE风险评估表
- 一年级上册美术教案-第1课 让大家认识我:诚实最好 ▏人美版
- 科学认识天气智慧树知到期末考试答案2024年
- (高清版)DZT 0064.15-2021 地下水质分析方法 第15部分:总硬度的测定 乙二胺四乙酸二钠滴定法
- 心理体检收费目录
- 雅鲁藏布江米林-加查段沿线暴雨泥石流危险度评价的中期报告
- 抗生素的正确使用与合理配比
- 读书分享读书交流会《局外人》课件
- 第十六章-常见骨关节疾病评定技术-2肩周炎评定
评论
0/150
提交评论