Data Structure Using C++ (Queue) I Need To Edite This Code Like The Picture down please help me ::  C++ ,, Queue STL  This is the code #include #include #include using namespace std; int main() { srand((unsigned)time(NULL)); int n; int longest_wait = INT_MIN; double avg_wait = 0; double total_wait = 0; int customers_served = 0; queueq; int upper = 2; int lower = 0; cout<<"Enter time for simulation : "; cin>>n; for(int i=0;i

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
100%

Data Structure Using C++ (Queue)

I Need To Edite This Code Like The Picture down please help me :: 

C++ ,, Queue STL 

This is the code

#include <iostream>
#include <ctime>
#include <queue>

using namespace std;


int main()
{
srand((unsigned)time(NULL));


int n;
int longest_wait = INT_MIN;
double avg_wait = 0;
double total_wait = 0;
int customers_served = 0;


queue<int>q;

int upper = 2;
int lower = 0;

cout<<"Enter time for simulation : ";
cin>>n;


for(int i=0;i<n;i++)
{

if(!q.empty())
{
int customer_join_time = q.front();
q.pop();
customers_served++;


int customer_wait = i - customer_join_time;
longest_wait = max(longest_wait,customer_wait);
total_wait+= customer_wait;
}


int num_cus = (rand() % (upper - lower + 1)) + lower;


for(int j=1;j<=num_cus;j++)
{
q.push(i);
}
}

avg_wait = total_wait/customers_served;

cout<<"Customers Served: " << customers_served << "\n";
cout<<"Average Wait: " << avg_wait << "\n";
cout<<"Total Wait: " << total_wait <<"\n";


system("pause");
return 0;
}

this code used to cin the value i don't need to input any thing the program start directly using the picture number 2 like this table with the cin values please 

Test Plan for "Check-out Line" Simulation Program
Total Number of
Time (minutes)
Average Wait Longest Wait
Customers Served
30
60
120
480
Transcribed Image Text:Test Plan for "Check-out Line" Simulation Program Total Number of Time (minutes) Average Wait Longest Wait Customers Served 30 60 120 480
time in minutes
total served customers
average wait
longest wait
30
19
| 1.68421
60
29
1.37931
120
98
| 2.27551
480
381
2.53543
9
Pr
2.
Transcribed Image Text:time in minutes total served customers average wait longest wait 30 19 | 1.68421 60 29 1.37931 120 98 | 2.27551 480 381 2.53543 9 Pr 2.
Expert Solution
steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY