This is A queuing System Simulator program that simulate the system that support services for more than one customer(Queue) for some time depending on randamization (Good Simulator).
#include<iostream> #include <cmath> #include "lcgrand.h" using namespace std;
///////////////////////////////////////////////////////////////////////// const int Queu_Limit=100; const int BUSY=1; const int IDLE=0;
int choice, Num_Completed_Customers, //Number of Completed Customers Number_of_Events, //Number of Events 1.Arriving 2.Completion Number_in_Queue, //Number of Customers In Queue Server_Status; //Server Status ( Idle , Busy )
/* Prime modulus multiplicative linear congruential generator Z[i] = (630360016 * Z[i-1]) (mod(pow(2,31) - 1)), based on Marse and Roberts' portable FORTRAN random-number generator UNIRAN. Multiple (100) streams are supported, with seeds spaced 100,000 apart. Throughout, input argument "stream" must be an int giving the desired stream number. The header file lcgrand.h must be included in the calling program (#include "lcgrand.h") before using these functions.
Usage: (Three functions)
1. To obtain the next U(0,1) random number from stream "stream," execute u = lcgrand(stream); where lcgrand is a float function. The float variable u will contain the next random number.
2. To set the seed for stream "stream" to a desired value zset, execute lcgrandst(zset, stream); where lcgrandst is a void function and zset must be a long set to the desired seed, a number between 1 and 2147483646 (inclusive). Default seeds for all 100 streams are given in the code.
3. To get the current (most recently used) integer in the sequence being generated for stream "stream" into the long variable zget, execute zget = lcgrandgt(stream); where lcgrandgt is a long function. */