Modify the Queue.h file to be a templated Queue class. The queue class will add to the
Question:
Modify the Queue.h file to be a templated Queue class.
The queue class will add to the back of the queue and remove items from the front.
Don't forget to check your class with numbers and strings to make sure it works.
Queue.h
#pragma once
#include
using namespace std;
struct Node{
string data;
Node*next;
};
class Queue
{
public:
//Constructs an empty queue
Queue();
//Destructor to free up memory
~Queue();
//Returns true if the stack is empty
bool isEmpty();
//Adds an item to the end of the queue
void add(string data);
// Removes the item at the front of the queue
void remove();
// Returns the value in the front of the queue (without removing)
string peek();
//Overloads the extraction operator to display the queue
friend ostream &operator << (ostream &out, const Queue &s);
private:
Node *front;
Node *back;
};
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill