#includeiostream#includestring#includealgorithm#includetime.h#includestackusingnamespacestd;////////////////////////////银行叫号系统//////////////////////////////////////classord_window{public:intnumber;intleave_time;ord_window(){leave_time=0;}};classvip_window{public:intnumber;intleave_time;vip_window(){leave_time=0;}};classoff_window{public:intnumber;intleave_time;off_window(){leave_time=0;}};classbanksystem{ord_window*ord;vip_window*vip;off_window*off;intord_w_n;intvip_w_n;intoff_w_n;public:banksystem(intord,intvip,intoff);booladd_user();boolfunction(chainqueueintord_user,chainqueueintord__usertime,chainqueueintvip_user,chainqueueintvip__usertime,chainqueueintoff_user,chainqueueintoff__usertime);};banksystem::banksystem(intord,intvip,intoff){this-ord=neword_window[ord];this-vip=newvip_window[vip];this-off=newoff_window[off];ord_w_n=ord;vip_w_n=vip;off_w_n=off;}boolbanksystem::function(chainqueueintord_user,chainqueueintord_user_time,chainqueueintvip_user,chainqueueintvip_user_time,chainqueueintoff_user,chainqueueintoff_user_time){inta=0;intb=0;intc=0;longt;while(1){a=0;b=0;c=0;while(aord_w_n){if((ord+a)-leave_time==0&&!ord_user.isempty()){(ord+a)-number=ord_user.dequeue();(ord+a)-leave_time=ord_user_time.dequeue();cout\na+1号普通窗口叫号-(ord+a)-number号顾客;}a++;}while(bvip_w_n){if((vip+b)-leave_time==0&&!vip_user.isempty()){(vip+b)-number=vip_user.dequeue();(vip+b)-leave_time=vip_user_time.dequeue();cout\nb+1号vip窗口叫号-(vip+b)-number号顾客;}elseif((vip+b)-leave_time==0&&!ord_user.isempty()){(vip+b)-number=ord_user.dequeue();(vip+b)-leave_time=ord_user_time.dequeue();cout\nb+1号vip窗口叫号-(vip+b)-number号顾客;}b++;}while(coff_w_n){if((off+c)-leave_time==0&&!off_user.isempty()){(off+c)-number=off_user.dequeue();(off+c)-leave_time=off_user_time.dequeue();cout\nc+1号对公窗口叫号-(off+c)-number号顾客;}elseif((off+c)-leave_time==0&&!ord_user.isempty()){(off+c)-number=ord_user.dequeue();(off+c)-leave_time=ord_user_time.dequeue();cout\nc+1号对公窗口叫号-(off+c)-number号顾客;}c++;}t=(long)time(NULL);while(t==time(NULL));a=0;b=0;c=0;while(aord_w_n){(ord+a)-leave_time--;a++;}while(bvip_w_n){(vip+b)-leave_time--;b++;}while(coff_w_n){(off+c)-leave_time--;c++;}if(vip_user.isempty()&&ord_user.isempty()&&off_user.isempty()&&off-leave_time=0&&vip-leave_time=0&&ord-leave_time=0)break;}cout\ntheend!\n;return1;}//intmain()//{////chainqueueintord_user;//chainqueueintord_user_time;//chainqueueintvip_user;//chainqueueintvip_user_time;//chainqueueintoff_user;//chainqueueintoff_user_time;////输入三*2个队列//intn,temp,i,time;//i=1;//cout输入办业务总人数:\n;//cinn;//while(n--)//{//cout输入类型1(普通业务),2(vip业务),3(对公业务)\n;//cintemp;//if(temp==1){ord_user.enqueue(i);cout时间:;cintime;ord_user_time.enqueue(time);}//if(temp==2){vip_user.enqueue(i);cout时间:;cintime;vip_user_time.enqueue(time);}//if(temp==3){off_user.enqueue(i);cout时间:;cintime;off_user_time.enqueue(time);}//i++;//}//////banksystema(3,1,1);//a.function(ord_user,ord_user_time,vip_user,vip_user_time,off_user,off_user_time);//////////}