beautypg.com

HP Integrity NonStop H-Series User Manual

Page 128

background image

}

To run the simulation we simply create some number of initial events (say, 30 minutes worth), then invoke
the run() member function.

void main() {
// load queue with some number of initial events
unsigned int t = 0;
while (t < 30) {
t += rand(6);
theSimulation.scheduleEvent(
new arriveEvent(t, 1 + randomInteger(4)));
}

// then run simulation and print profits
theSimulation.run();
cout << "Total profits " << theSimulation.profit << endl;
}

This manual is related to the following products: