[try Beta version]
Not logged in

 
question regarding a simple <queue> program!

Feb 28, 2016 at 1:04pm
So this program is about a queue line in the customer service at the bank.
every 3 minutes a new customer arrives, and every 5 minutes a customer is done.

my simple question is why is it not working??

#include<iostream>
#include<queue>
using namespace std;


int main(){
queue<char> Q;
int temp = 1;
cout << "This program will calculate the customer service throughout the next 30 minutes.\n"
"Since a customer enters USBank every 3 minutes, but
it would take 5 minutes to finish each customer." << endl;
cout << "The customer service opens at 8:10 am" << endl;
for (int i = 0; i <= 30; i++)
{
if (i % 3 == 0)
{
cout << "A new customer just arrived." << endl;
Q.push(temp);
temp = temp + 1;
}
if (i % 5 == 0){
cout << "customer is served" << endl;
Q.pop();
Q.front();
}
}
return 0;
}
Feb 28, 2016 at 1:13pm
Can you be any more specific than "not working"? What does it do that it shouldn't, and what doesn't it do that it should? Also, please format you code (highlight it and click the <> format button), it makes it much more readable, and also usually allows people to try the code without having to set up an offline project.
Last edited on Feb 28, 2016 at 1:13pm
Feb 28, 2016 at 1:17pm
@AmmmG 01

There have been a bunch of topics about this same subject: The queue at the bank. Could we ask you to please just keep the one topic going, rather than starting new topics all the time? Thanks :+)
Topic archived. No new replies allowed.