File Compare Write a program that opens two text files and reads their contents into two separate queues....

90.2K

Verified Solution

Question

Programming

File Compare
Write a program that opens two text files and reads their contentsinto two separate
queues. The program should then determine whether the files areidentical by comparing
the characters in the queues. When two nonidentical characters areencountered,
the program should display a message indicating that the files arenot the same. If both
queues contain the same set of characters, a message should bedisplayed indicating
that the files are identical.

// Copyright (c) 2013 __Pearson Education__. All rightsreserved.

/** ADT queue: Link-based implementation.

Listing 14-3.

@file LinkedQueue.h */

#ifndef _LINKED_QUEUE

#define _LINKED_QUEUE

#include \"QueueInterface.h\"

#include \"Node.h\"

#include \"PrecondViolatedExcep.h\"

template

class LinkedQueue : public QueueInterface

{

private:

   // The queue is implemented as a chain of linkednodes that has

   // two external pointers, a head pointer for frontof the queue and

   // a tail pointer for the back of the queue.

   Node* backPtr;

   Node* frontPtr;

public:

   LinkedQueue();

   LinkedQueue (const LinkedQueue& aQueue);

   ~LinkedQueue();

       bool isEmpty() const;

       bool enqueue(constItemType& newEntry);

       bool dequeue();

  

   /** @throw PrecondViolatedExcep if the queue isempty */

       ItemType peekFront() constthrow(PrecondViolatedExcep);

}; // end LinkedQueue

#include \"LinkedQueue.cpp\"

#endif

Answer & Explanation Solved by verified expert
4.2 Ratings (535 Votes)
DynamicQueue DynamicQueuehh means header ifndef DYNAMICQUEUEH define DYNAMICQUEUEH include include for badalloc using namespace std template class DynamicQueue private struct for Node struct Node to hold node value T value pointer to next Node Node next pointer to front of queue Node frontNode Node rearNode public constructor DynamicQueue make    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students