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
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](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fd4280b4e-468d-436e-9d33-86e46fb246ef%2Fd58417dc-5dbe-4bce-a77b-4403357174e8%2F81snv9i_processed.png&w=3840&q=75)
![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.](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fd4280b4e-468d-436e-9d33-86e46fb246ef%2Fd58417dc-5dbe-4bce-a77b-4403357174e8%2Fistxeu7_processed.jpeg&w=3840&q=75)
![](/static/compass_v2/shared-icons/check-mark.png)
Step by step
Solved in 2 steps with 1 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
![Concepts of Database Management](https://www.bartleby.com/isbn_cover_images/9781337093422/9781337093422_smallCoverImage.gif)
![Prelude to Programming](https://www.bartleby.com/isbn_cover_images/9780133750423/9780133750423_smallCoverImage.jpg)
![Sc Business Data Communications and Networking, T…](https://www.bartleby.com/isbn_cover_images/9781119368830/9781119368830_smallCoverImage.gif)