Answered step by step
Verified Expert Solution
Link Copied!
Question
1 Approved Answer

Q:how i can write these code without using pair or struct(just use library for queueand don't use any thing else) #include #include using namespace std;

Q:how i can write these code without using pair or struct(just use library for queueand don't use any thing else)

#include #include using namespace std; int main() { int time_t; cout<<"Enter the time limit : "; cin>>time_t; //int n=time_t; queue >q; int nop=0,nops=0,max=0,totalwait=0,numbermax; float average; while(time_t!=0) { int x; /*Asking for new added passengers in the queue*/ cout<<"Please enter the number of passengers entered(between 0 to 2)- "; cin>>x; if(x<0 or x>2) { /* If number of passengers is not between 0 to 2 then ask again for valid entry*/ cout<<"Please enter valid number of new passengers"< served= q.front(); //passsenger who is given the ticket totalwait+= served.second; cout<<"Waiting time for passsenger number "<max) { max=served.second; //update the maximum Waiting time numbermax=served.first; } nops++; q.pop(); time_t--; } cout<<"Total passengers served during " <

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image
Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction To Constraint Databases

Authors: Peter Revesz

1st Edition

1441931554, 978-1441931559

More Books

Students explore these related Databases questions