Skip to content

Commit 6a6be77

Browse files
committed
update example code in the readme
1 parent eaf529c commit 6a6be77

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ This is a simple implementation of a one-way linked-list in C++.
77
```c++
88
// Create new list
99
OneWayLinkedList* list = new OneWayLinkedList();
10+
1011
// Add some nodes
1112
list->addEnd(1);
1213
list->addEnd(2);
@@ -23,9 +24,14 @@ list->print();
2324
cout << "Size: " << list->getSize() << endl;
2425

2526
// Reverse the current list
27+
cout << "Reverse the list" << endl;
2628
list->reverse();
2729

30+
// Print all nodes
31+
list->print();
32+
2833
// Reverse the current list with a recursive function
34+
cout << "Reverse the list with a recursive function" << endl;
2935
list->reverseRecursive(list->getFirstNode());
3036

3137
// Print all nodes

example.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ using namespace std;
66
int main(int argc, char** argv) {
77
// Create new list
88
OneWayLinkedList* list = new OneWayLinkedList();
9+
910
// Add some nodes
1011
list->addEnd(1);
1112
list->addEnd(2);

0 commit comments

Comments
 (0)