⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 arriveevent.cpp

📁 产生一个随机数
💻 CPP
字号:
#include<iostream.h>
#include"event.h"
#include"arriveEvent.h"
#include"leaveEvent.h"
#include"orderEvent.h"
#include<assert.h>
#include<stdlib.h>
#include"customerGroup.h"
#include"simulation.h"
#include"storeSimulation.h"
#include"random.h"
extern storeSimulation store;
arriveEvent::arriveEvent(unsigned int t,customerGroup* g)
                     :group(g),event(t)
                     {}
void arriveEvent::processEvent()
{      
		random m_randomvalue;
     cout<<"Customer group of size "<<group->groupsize
         <<" , arrives at time"<<time<<'\n';
     if(group->groupsize<store.freeChairs){
          store.freeChairs-=group->groupsize;
          event*oe=new orderEvent(time+m_randomvalue.between(2,8),group);
          assert(oe!=0);
          store.scheduleEvent(oe);
     }
     else
         cout<<"No  space:group leaves.\n";
}                                         

⌨️ 快捷键说明

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