Question: IT HAS TO BE DONE IN C++ I ONLY UNDERSTAND C++ THANKS ! ***It is not checking number of characters! I have to check character

 IT HAS TO BE DONE IN C++ I ONLY UNDERSTAND C++

IT HAS TO BE DONE IN C++ I ONLY UNDERSTAND C++ THANKS !

***It is not checking number of characters! I have to check character by character and see if sentence is identical***

===============================

#ifndef QUEUE_H #define QUEUE_H #include #include using namespace std;

class Queue { private: char *qArray; int qSize; int front; int rear; int numItems; public: Queue(int); Queue(const Queue &); ~Queue(); void enqueue(char); void dequeue(char &); bool isEmpty() const; bool isFull() const; void clear(); }; #endif

================================

#include "Queue.h"

Queue::Queue(int size) { qArray = new char[size]; qSize = size; front = -1; rear = -1; numItems = 0; }

Queue::Queue(const Queue &obj) { qArray = new char[obj.qSize]; qSize = obj.qSize; front = obj.front; rear = obj.rear; numItems = obj.numItems; for(int i=0; i qArray[i] = obj.qArray[i]; }

Queue::~Queue() { delete [] qArray; }

void Queue::enqueue(char num) { if(isFull()) cout

void Queue::dequeue(char &num) { if(isEmpty()) cout

bool Queue::isEmpty() const { bool status; if(numItems > 0) status = false; else status = true; return status; }

bool Queue::isFull() const { bool status; if(numItems

void Queue::clear() { front = qSize - 1; rear = qSize - 1; numItems = 0; }

This is what i have so far. I am having hard time how to demonstrate it in the main. After reading two sentenes from the user and putting it in seperate queues in the array one by one and comparing it. I just need help with main. Above picture is the problem.

Write a program that reads two sentences and reads them into two separate queues. The program should then determine whether the sentences are identical by comparing the characters in the queues. When two non-identical characters are encountered, the program should display a message indicating that the sentences are not the same. If both queues contain the same set of characters, message should be displayed indicating that the sentences are identical

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!