rendered paste body/*Group 13Thomas BiddleSam ReedCraig Ashworth*/#include<iostream>#include<string>using namespace std;// Node struct with variables.struct Node {public: string item; // data int numberOfEmails; // Number of emails Node* next; // pointer to next};// List class with functions.class List {public: List(void) { head = NULL; } // constructor ~List(void); // destructor bool IsEmpty() { return head == NULL; } int InsertNode(int i, string x); int IfExists(string x); int Delete(string x); void DisplayList(void);private: Node* head; Node* prev;};// Inserts new node into list.int List::InsertNode(int i, string x) { if (i < 0) return 0; int currIndex = 1; Node* currNode = head; while (currNode && i > currIndex) { currNode = currNode->next; currIndex++; } if (i > 0 && currNode == NULL) return 0; Node* newNode = new Node; newNode->item = x; newNode->numberOfEmails = 1; if (i == 0) { if (IfExists(x)) { ; return 0; } newNode->next = head; head = newNode; } else { newNode->next = currNode->next; currNode->next = newNode; } return 1; }//end InsertNode// If the node exists, increase the email count.int List::IfExists(string x) { Node* currNode = head; int currIndex = 1; while (currNode && currNode->item != x) { currNode = currNode->next; currIndex++; } if (currNode) { currNode->numberOfEmails++; return currIndex; } return 0;}//END IfExists// Delete a node.int List::Delete(string x) { Node* prevNode = NULL; Node* currNode = head; int currIndex = 1; while (currNode && currNode->item != x) { prevNode = currNode; currNode = currNode->next; currIndex++; } if (currNode) { if (prevNode) { prevNode->next = currNode->next; delete currNode; } else { head = currNode->next; delete currNode; } return currIndex; } return 0;}// Display the email list.void List::DisplayList(){ int num = 0; Node* currNode = head; int totalNumberOfEmails = 0; while (currNode != NULL){ cout << currNode->item << " - " << currNode->numberOfEmails << endl; totalNumberOfEmails += currNode->numberOfEmails; currNode = currNode->next; num++; } cout << "Number of nodes in the list: " << num << endl; cout << "Total number of emails: " << totalNumberOfEmails << endl;}/*void List::PushBack() { Node* left = head; left = left->next; Node* middle = left->next; Node* right = middle->next; Node* watch = left; while (watch != NULL) { left = }*/// Node deconstructor.List::~List(void) { Node* currNode = head, *nextNode = NULL; while (currNode != NULL) { nextNode = currNode->next; // destroy the current node delete currNode; currNode = nextNode; }}int main() { string UserInput; List newList; while (UserInput != "done") { cout << endl << "Please enter the subject of your email, type 'done' when finished." << endl; cin >> UserInput; if (UserInput == "done") break; if (newList.IfExists(UserInput) == 0) newList.InsertNode(0, UserInput); } newList.DisplayList(); return 0;}