Compare a list with ten nodes

zhaozj2021-02-16  59

#include class node // {public: node * next; int data; node (const INT & ITEM, NODE * PTRNEXT = NULL); // Construct Void INSERTAFTER (Node * P); // Insert Node * thisnode (void); // Return to the pointer of this node}; Node :: Node (const IT & Item, Node * PtrNext) {data = item; Next = PtrNext;

} void node :: INSERTAFTER (Node * lastptr) {lastptr-> Next = this-> next; this-> next = lastptr;} node * node :: thisnode (void) {returnid;} void main () {int A, I; Node * lastptr, * head, * currptr; cout << "please input A: << ENDL; CIN >> A; Node Example1 (a); head = example1.thisode (); currptr = head; For (i = 0; i <9; i ) {lastptr = example1.thisNode (); cin >> a; node example1 (a); example1.insertafter (lastptr);} cout << Endl; while (currptr! = NULL) {cout << currptr-> data; currptr = currptr-> next;}}

How should this program modified? Thank you

转载请注明原文地址:https://www.9cbs.com/read-21874.html

New Post(0)