?? 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 + -