
Faria R.
asked 07/29/21I am feeling this code.Can u slove it so I can copy and paste it.
https://8dfd4c4f-a-686c9e04-s-sites.googlegroups.com/a/northsouth.edu/cse225/Lab07.pdf?attachauth=ANoY7crxzVMVjv0xsQ99O60Rv2BccKwtT6Fu5hQY0srA819FgXzzToou7413SJoIqPQnZ-eWJSqcofLInAt6JTZqfPTnmTBnyz-S3fAtpqRjNBgyI5C_6Ktmlparh7WqnD5n9m550XBregU_425LlMfnYAy_5K7LlHY-8zfwZ9WP0kMZYfikeQ4-3mjrJnVUcLSxTGkqaeMT&attredirects=0
1 Expert Answer

Patrick B. answered 07/30/21
Math and computer tutor/teacher
using namespace std;
#include <iostream>
#include <string>
int main()
{
QueType<int> q(5);
int iNums[]={5,7,4,2};
int iNum=6;
cout << " in the beginning....." <<endl;
if (q.IsEmpty()) { cout << " queue is empty" << endl; } else { cout << "queue is not empty" <<endl; }
if (q.IsFull() ) { cout << " queue is full " << endl; } else { cout << "queue is not full " <<endl; }
cout << "pushing 4 ints....." <<endl;
for (int iLoop=0; iLoop<4; iLoop++)
{
q.Enqueue(iNums[iLoop]);
}
if (q.IsEmpty()) { cout << " queue is empty" << endl; } else { cout << "queue is not empty" <<endl; }
if (q.IsFull() ) { cout << " queue is full " << endl; } else { cout << "queue is not full " <<endl; }
try
{
cout << "pushing " <<iNum <<endl;
q.Enqueue(iNum);
if (q.IsEmpty()) { cout << " queue is empty" << endl; } else { cout << "queue is not empty" <<endl; }
if (q.IsFull() ) { cout << " queue is full " << endl; } else { cout << "queue is not full " <<endl; }
iNum=8; cout << "pushing " <<iNum<<endl;
q.Enqueue(iNum);
if (q.IsEmpty()) { cout << " queue is empty" << endl; } else { cout << "queue is not empty" <<endl; }
if (q.IsFull() ) { cout << " queue is full " << endl; } else { cout << "queue is not full " <<endl; }
}
catch(FullQueue ex)
{
cout << "Queue full exception " <<endl;
}
catch(EmptyQueue ex)
{
cout << "Queue empty exception " <<endl;
}
q.Dequeue(iNum);
q.Dequeue(iNum);
while (!q.IsEmpty())
{
q.Dequeue(iNum);
cout << " popped " << iNum <<endl;
}
if (q.IsEmpty()) { cout << " queue is empty" << endl; } else { cout << "queue is not empty" <<endl; }
if (q.IsFull() ) { cout << " queue is full " << endl; } else { cout << "queue is not full " <<endl; }
try
{
q.Dequeue(iNum);
}
catch(EmptyQueue ex)
{
cout << "Queue empty exception " <<endl;
}
QueType<string> qBinaryStr;
string binaryStr="1";
qBinaryStr.Enqueue(binaryStr);
int N=-1;
while (N<0)
{
cout << "How Many binary strings??? :>";
cin >>N;
}
for (int iLoop=0; iLoop<N;iLoop++)
{
string curBinaryStr;
qBinaryStr.Dequeue(curBinaryStr);
cout << curBinaryStr<<endl;
qBinaryStr.Enqueue(curBinaryStr+"0");
qBinaryStr.Enqueue(curBinaryStr+"1");
}
}
Still looking for help? Get the right answer, fast.
Get a free answer to a quick problem.
Most questions answered within 4 hours.
OR
Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.
Patrick B.
You need to look at the PUBLIC method functions in the class and then use them to follow the directions07/30/21