Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This is the assignment, Create a simple C++ linked list program to create a clas

ID: 3540840 • Letter: T

Question

This is the assignment,


Create a simple C++ linked list program to create a class list containing:

class node

{
void *info;
node *next;


public:
node (void *v) {info = v; next = 0; }
void put_next (node *n) {next = n;}
node *get_next ( ) {return next;}
void *get_info ( ) {return info;}
};

Be able to initially fill the list. Provide functions to insert/append nodes and remove
nodes from the linked list. Be able to display the contents of the list.

Write a little driver program with at least 5 values passed in (so that 5 nodes are created)
as you insert/append, delete and display data, showing the programs operation.



Explanation / Answer


class node {


public:


void *info;


node *next;


node (void *v) {info = v; next = 0; }


void put_next (node *n) {next = n;}


node *get_next ( ) {return next;}


void *get_info ( ) {return info;}


};


class list {


public:


node *head;


int node_num;


list ( ) { node_num = 0; head = 0;}


void remove (int);


void insert (void *, int);


void append (void * v) {insert (v, node_num + 1); }


void *find (int);


void display ( );


};

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote