aboutsummaryrefslogtreecommitdiff
path: root/CST 126/Homework_3/program.cpp
blob: 57efc9dc0d15b720e5c4d89cb1a63bdb7f2632af (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include "node.hpp"
#include "linked_list_nodes.hpp"


struct Node {
	int _num;

};

struct ListNode {
	Node data;
	ListNode* _next; 

};

Node DoublesNodeData(Node node);
void DoublesNodeDataRef(Node& node);

int main(const int argc, char* argv[]) {
	/* Node new_node{};

	new_node._num = 5;

	cout << "Node's num is " << new_node._num << std::endl;

	new_node = DoublesNodeData(new_node);

	std::cout << "Node's num after double is " << new_node._num << std::endl; */

	ListNode newListNode{};
	Node newData{};
	newData._num = 10;
	newListNode.data = newData;

	ListNode secondListNode{};
	secondListNode.data = newData;

	newListNode._next = &secondListNode;

	cout << "We can get to the first and second node: " << newListNode._next->data._num << secondListNode.data._num;


	return 0;
}


Node DoublesNodeData(Node node) {
	node._num *= 2;
	return node;
}

void DoublesNodeDataRef(Node& node) {
	node._num *= 2;
}