Solved by verified expert:see the attachment upload screenshots of your final output .
lab_13___statck_and_queues.pdf
Unformatted Attachment Preview
Lab 13
COSC 214
Tuesday, October 23, 2017
(Due in Dropbox by 2:30 PM)
Write a programming segment/function (in .ccp for example) that uses a stack and a
queue of integers. Use the random # generator and a loop to generate 100 integers
between 0 and 101. As the integers are being generated, place the odd #’s in a stack and
the even #s in a queue.
After the #’s have been placed in the appropriate stack and queue, your code will need to
go back through the stack and queue:
o Compare each #, until the stack or queue is empty, and count the # of times
the #’s the number being removed from the stack is within 10 of the number
being removed from the queue. (Example: if the stacktop stores 17 and queue
front stores 22, then that is one occurrence, then move on to the next element
in the stack and queue. Etc…)
// Random # Example Program
#include
#include
#include
using namespace std;
int main()
{
int num,max_number;
cout<<"This program will generate 10 random numbers"<>max_number;
int i = 1;
while ( i <= 10 )
{
num = ((rand() + time(0)) % max_number) + 1;
cout<< num<
Purchase answer to see full
attachment