电梯模拟课程设计实验报告
k[outfloor].Push(*this); //wait(25); cout<<clock()/TIME-delay/TIME<<","<<nexttime/TIME<<":"<<number<<"号乘客从"<<infloor<<"楼进入电梯。"<<endl; callcar[outfloor]=1; } }
void man::onwait() { s[infloor].EnQueue(*this); //wait(25); cout<<clock()/TIME-delay/TIME<<","<<nexttime/TIME<<":"<<number<<"号乘客进入"<<infloor<<"楼的等待队列。"<<endl; }
long man::giveup() { cout<<clock()/TIME-delay/TIME<<","<<nexttime/TIME<<":"<<number<<"号乘客放弃等待"<<endl; return 0; }
void man::getout() { cout<<clock()/TIME-delay/TIME<<","<<nexttime/TIME<<":"<<number<<"号乘客出电梯"<<endl; }
//--------------------------------时间函数定义----------------------------------- int shuru();
int wait(long tt)//延时控制函数 { //cout<<clock()/TIME-delay/TIME<<","<<nexttime/TIME<<":"<<"wait 计时开始"<<endl; clock_t end; //end=clock()+tt*TIME; end=clock()-delay; while(clock()<end+delay+tt*TIME)//修正只用当前时刻造成的错误 { if((clock()-delay)>=nexttime)//当 当前时刻 大于等于下一个人到来的时刻时,调用输入函数 { shuru();