orderevent.h

来自「数据结构」· C头文件 代码 · 共 44 行

H
44
字号
#ifndef _orderEvent
#define _orderEvent

#include"event.h"
#include"leaveEvent.h"
#include"customerGroup.h"
#include"storeSimulation.h"
#include"random.h"

#include<iostream.h>
#include<assert.h>


class orderEvent:public event
{
 public:
	 orderEvent(unsigned int,customerGroup*);
	 virtual void processEvent();
 private:
	 customerGroup* group;
};


orderEvent ::orderEvent(unsigned int time1,customerGroup* gup): event(time1),group(gup)
{
}


void orderEvent::processEvent()//点单
{
	int hours,minuters;
	hours=time/60+8;
	minuters=time%60;		

    int scoops=group->orderSize();
    cout<<hours<<"点"<<minuters<<"分钟"<<"    "<<"有"<<group->groupsize<<"人点了"<<scoops<<"个冰淇淋."<<endl;
    store.order(scoops);
    event*le=new leaveEvent(time+randgen.between(15,35),group);
    assert(le!=0);
    store.scheduleEvent(le);
}

#endif   

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?