Guest User

Untitled

a guest
Feb 19th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. class node
  5. {
  6. public:
  7. string data;
  8. node * next;
  9. };
  10.  
  11.  
  12. int main()
  13. {
  14.  
  15. node * A;
  16. A = new node;
  17. (*A).data = "node1";
  18.  
  19.  
  20. node * B;
  21. B = new node;
  22. (*B).data = "node2";
  23.  
  24. node * C;
  25. C = new node;
  26. (*C).data = "node3";
  27.  
  28. (*A).next = B;
  29. (*B).next = C;
  30. (*C).next = NULL;
  31.  
  32. for(int i=0; *(next) != NULL; i++)
  33. {
  34. cout << *next[i[] << endl;
  35. }
  36.  
  37.  
  38. system("pause");
  39. return 0;
  40. }
Add Comment
Please, Sign In to add comment