Question: Task: Develop a program that initialize an integer queue (values between 1 and100) and then remove keys where key = 17 and then print the

Task:

Develop a program that initialize an integer queue (values between 1 and100) and then remove keys where key = 17 and then print the queue.

Your main function may look like:

#include //queue template library

#include //for time()

#include //rand(), srand()

#include

using namespace std;

template

void remove_keys( queue &q, int key);

int main()

{

queue q;

int i, temp;

srand(time(NULL));//set a seed for random number generator

for( i = 0; i < 100; i++)

{

temp = rand()%100+1;

q.push(temp); //push an item onto the queue

cout<

}

remove_keys(q, 17);

while( !q.empty())

{

cout<

q.pop();

}

cout<

return 0;

}

The programming Language is C++

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!