Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases Illuminated

Authors: Catherine M. Ricardo, Susan D. Urban, Karen C. Davis

4th Edition

1284231585, 978-1284231588

More Books

Students also viewed these Databases questions

Question

Why is the System Build Process an iterative process?

Answered: 1 week ago