Question: This is data structure class. I need a code in C++. Please, give screen shot of running program. Below is my program, it is a

This is data structure class. I need a code in C++. Please, give screen shot of running program. Below is my program, it is a linked list with 2 nodes. 
You can use this or write a similar one. 
I am trying to write 2 functions. One function will add another node at the end of the list. The other function will delete a node. Please, do not use dangling pointers ! 
Thank you. 

This is data structure class. I need a code in C++. Please,

#include using namespace std; class Node { int data; Node *next; public: void setdata(int d) {data = d;} void setnext(Node *p) { next = p; } int getdata() {return data;} Node getnext() {return *next;} }; int main() { Node *N1 = new Node; N1->setdata(1000); Node *N2 = new Node; N2->setdata(2000); N1->setnext( N2) ; N2->setnext(NULL); system("pause"); return 0; } 

Please, do not copy from other chegg answers for this questions.

#include using namespace std; class Node int data; Node *next; public: void setdata(int d) void setnext (Node *p) next - p; > int getdata) freturn data;h {data = d;} Node getnext() (return *next; int main() Node *N1 = new Node ; N1->setdata(1000); Node *N2 new Node; N2->setdata(2000); N1->setnext( N2); N2->setnext (NULL); system("pause"); return 0

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!