25 lines
520 B
C++
25 lines
520 B
C++
|
#include <iostream>
|
||
|
#include <cassert>
|
||
|
#include "linkedlist.h"
|
||
|
#include "node.h"
|
||
|
|
||
|
using namespace std;
|
||
|
|
||
|
int main() {
|
||
|
node* head = new node(0, head);
|
||
|
node* tom = new node(1, NULL);
|
||
|
node* dick = new node(2, NULL);
|
||
|
head->next = tom;
|
||
|
tom->next = dick;
|
||
|
node* node_ptr = head;
|
||
|
while(node_ptr != NULL) {
|
||
|
cout << node_ptr->value;
|
||
|
if(node_ptr != NULL) {
|
||
|
cout << "====>";
|
||
|
}
|
||
|
node_ptr = node_ptr->next;
|
||
|
}
|
||
|
cout << endl;
|
||
|
cout << dick->next << endl;
|
||
|
}
|