/quetype.h: (Added one more function front_element() which will return the first element of the queue, which will be required while displaying the queue) #ifndef QUETYPE_H_INCLUDED #define QUETYPE_H_INCLUDED class class FullQueue {}; class EmptyQueue {}; template class QueType { struct NodeType { ItemType info; NodeType* next; }; public : QueType(); ~QueType(); void MakeEmpty(); void Enqueue(ItemType); void Dequeue(ItemType&); bool IsEmpty(); bool IsFull(); ItemType front_element(); //Function to return the front element of queue private: NodeType *front, *rear; }; #endif // QUETYPE_H_INCLUDED //quetype.***: #include "quetype.h" #include using namespace std; template //Template declared QueType::QueType() //Cosntructor { front = NULL; rear = NULL; } template bool QueType::IsEmpty() //Will return true if queue is empty else false { return (front == NULL); } template bool QueType::IsFull() //Will return true if queue is full { NodeType* location; try { location = new NodeType; delete location; return false; } catch(bad_alloc& exception) { return true; } } template void QueType::Enqueue(ItemType newItem) //To Enqueue element in queue { if (IsFull()) throw FullQueue(); else{ NodeType* newNode; newNode = new NodeType; newNode->info = newItem; newNode->next = NULL; if (rear == NULL) front = newNode; else rear->next = newNode; rear = newNode; } } template void QueType::Dequeue(ItemType& item) //To Dequeue element from queue { if(IsEmpty()) throw EmptyQueue(); else{ NodeType* tempPtr; tempPtr = front; item = front->info; front = front->next; if(front == NULL) rear = NULL; delete tempPtr; } } template void QueType::MakeEmpty() //Function to clear the queue { NodeType* tempPtr; while (front != NULL) { tempPtr = front; front = front->next; delete tempPtr; } rear = NULL; } template QueType::~QueType() //Destructor { MakeEmpty(); } template ItemType QueType::front_element() //Function which will return the frist element of queue { return front->info; } //main.*** #include "quetype.***" //Import quetype.*** file #include using namespace std; // n is size of coins array (number of different coins) int calCoins(int coins[], int n, int amount) //Function to calculate the number of coins { // table[i] will be storing the minimum number of coins // required for i value. So table[amount] will have result int table[amount+1]; // Base case (If given value amount is 0) table[0] = 0; // Initialize all table values as Infinite for (int **1; i<=amount; i++) table[i] = INT_MAX; // Compute minimum coins required for all // values from 1 to amount for (int **1; i<=amount; i++) { // Go through all coins smaller than i for (int j=0; j obj; //Create the object of Queue if(obj.IsEmpty()) //Check if queue is empty or not { cout<<"queue is empty\n"; } else { cout<<"queue is not empty\n"; } //Insert elements in Queue obj.Enqueue(5); obj.Enqueue(7); obj.Enqueue(4); obj.Enqueue(2); if(obj.IsEmpty()) //Again check if queue is empty { cout<<"queue is empty\n"; } else { cout<<"queue is not empty\n"; } QueType obj1; //Declare one more object of queue, which will keep copy of object obj //Loop to display the element of queue in same order while(1) { if(obj.IsEmpty()) break; //Break if queu is empty int front = obj.front_element(); obj1.Enqueue(front); //Insert element in obj1 (i.e. make copy of obj) cout<>n; int coins[n]; for(int i = 0; i < n; ++i) cin>>coins[i]; cin>>amount; cout<<"Coinse reqired to make amount of "<