Advertisement
_Kripaka001_

linkedList 0

Aug 11th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.65 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. class Node {
  6.     public:
  7.  
  8.         int value;
  9.         Node* next;
  10.  
  11.  
  12.         void unshift(){
  13.  
  14.         }
  15.  
  16.         void push(){
  17.  
  18.         }
  19.  
  20.         void shift(){
  21.  
  22.         }
  23.  
  24.         void pop(){
  25.  
  26.         }
  27. };
  28.  
  29. void output(Node* x){
  30.         if(x != 0){
  31.             cout << (*x).value << " ";
  32.             x = (*x).next;
  33.             output(x);
  34.         }
  35.         cout << endl;
  36. }
  37.  
  38. int main()
  39. {
  40.     Node a1, a2, a3, a4;
  41.     a1.value = 3;
  42.     a2.value= 8;
  43.     a3.value = 12;
  44.     a4.value = 23;
  45.  
  46.     a1.next = &a2;
  47.     a2.next = &a3;
  48.     a3.next = &a4;
  49.     a4.next = 0;
  50.  
  51.     output(&a1);
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement