elevsim.h

来自「某国际贸易中心共有40层」· C头文件 代码 · 共 49 行

H
49
字号
# ifndef _ELEVSIM_H
# define _ELEVSIM_H
# include <time.h>
# include <dos.h>
# include <stdlib.h>
# include "simulation.h"


enum Bool {false,true};

class simulation
{
  long timeSimulate;
  long timeRemaining;
  public:
    simulation();
    bool continues (void);
    void SetTime (long secs);
    long getTime(void);
    void reduceTime( long secs);
    void perform (void);
    void display(void);
    void results(void);
};

enum direction { DOWN=-1,NODIRECTION=0,UP=1 };

const int ESCKEY=27;
const int MAXELEVS=10;
const int MAXFLOORS=10;
const int MAXPERSONS=500;
const int ELEVWAIT=15;
const int CAPACITY=24;
const int TRAVELTIME=5;
time_t starttime,endtime;
int WantsToEnter(void) { return rand()<200;}
int EnterDest(void) { return 1+(rand()%(MAXFLOORS-1));}
int Maxwait(void) { return 180+(rand()%180);}
int Business(void) { return 400+(rand()%6200);}
bool leaving(void) { return rand()<22000?false:true;}
 int totalPeople=0;
 int inBuilding=0;
 int leftBuilding=0;
 int avgwait=0;
 int avgRide=0;
 int tookstair=0;
 int totalTime=0;

# endif

⌨️ 快捷键说明

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