📄 arriveevent.h
字号:
#ifndef _arriveEvent
#define _arriveEvent
#include"event.h"
#include"random.h"
#include"orderEvent.h"
#include"simulation.h"
#include"customerGroup.h"
#include"storeSimulation.h"
#include<assert.h>
#include<iostream.h>
class arriveEvent:public event//到达事件
{
public:
arriveEvent(unsigned int,customerGroup*);
virtual void processEvent();
private:
customerGroup* group;
};
arriveEvent::arriveEvent(unsigned int time1,customerGroup* gup):group(gup),event(time1)
{
}
void arriveEvent::processEvent()
{
int hours,minuters;
hours=time/60+8;
minuters=time%60;
cout<<hours<<"点"<<minuters<<"分钟"<<" "<<"有"<<group->groupsize<<"人到达."<<endl;
if(group->groupsize<store.freeChairs)
{
store.freeChairs-=group->groupsize;
event*oe=new orderEvent(time+randgen.between(2,10),group);
assert(oe!=0);
store.scheduleEvent(oe);
}
else
cout<<"没有剩余座位,顾客离去.\n";
}
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -