Question: Using the c++ code below create new class of student with studentID,StudentName,CGPA to add the student in the doubly Linked list aswell a function to

Using the c++ code below create new class of student with studentID,StudentName,CGPA to add the student in the doubly Linked list aswell a function to delete and replace and a function to check the duplicated added ID and display the count of duplicated number for each student and show the duplicated ID's in the doubly linked:

(use duoubly linked concept as code below)

#include

using namespace std;

class DoublyLL

{

private:

struct node

{

int data;

node *next;

node *pre;

};

node *head;

node *tail;

public:

DoublyLL()

{

head = NULL;

tail = NULL;

}

void addToTail(int number)

{

node *n = new node();

n->next = NULL;

n->pre = NULL;

n->data = number;

if (tail == NULL)

{

head = n;

tail = n;

cout << number << " is added to the tail" << endl;

}

else

{

tail->next = n;

n->pre = tail;

tail = n;

cout << number << " is added to the list" << endl;

}

}

void displayForward()

{

cout << "Printing in Forward order" << endl;

node *temp = head;

while (temp != NULL)

{

cout << temp->data << " ";

temp = temp->next;

}

cout << endl;

}

void displayReverse()

{

cout << "Printing in Reverse order" << endl;

node *temp = tail;

while (temp != NULL)

{

cout << temp->data << " ";

temp = temp->pre;

}

cout << endl;

}

};

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!