### Simulation program queuesystem

Hi! Im having problem with My code where i can't enter the last if.
This simulates a queuesystem.
Are My calculations right?

Seems like everything becomes 0 in size and servicetime...
Help!

 ``123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157`` ``````#include #include #include #include #include #include #include using namespace std; class Customer { public: int servicet; int served; Customer() { servicet= rand()%150+30; } int getServicetime() { return servicet; } int getServed() { return served; } int decreaseServeTime() { servicet --; } }; int totServed=0; int queues=0; int inLine=0; int totTime=0; int smallestQueue=0; int temp=0; int ran=0; double mean=0; int served=0; int serviceTime=0; int help=0; int sim=0; int n=0; using namespace std; int main() { cout<<"Number of Cashiers?: "<> queues; cout <<"How long simulation?: "<> sim; cout < *cashiers[queues]; list *cust; for(int i=0; i<=queues; i++) { cust = new list; cashiers[i] = cust; } srand(time(0)); while(nsize(); for(int j=0; jsize(); if(temp<=smallestQueue) { smallestQueue = temp; help=k; } } Customer C; cashiers[help]->push_back(C); inLine++; } for(int i=0; i0) { serviceTime = cashiers[i]->front().getServicetime(); cashiers[i]->front().decreaseServeTime(); } else if(serviceTime==0) { if(cashiers[i]->size()!=0){ cashiers[i]->pop_front(); served++; } } } totTime++; int cash=1; for(int i=0; isize(); if(inLine!=0) { cout <<"Kassa: "<
Topic archived. No new replies allowed.