Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

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

Automating Access Databases With Macros

Authors: Fish Davis

1st Edition

1797816349, 978-1797816340

More Books

Students also viewed these Databases questions

Question

Elucidate role and types of qualitative HR data

Answered: 1 week ago

Question

b. Will there be one assigned leader?

Answered: 1 week ago

Question

Do you currently have a team agreement?

Answered: 1 week ago