blob: ab09232c4b56c4c82c1af3b555064bcc38300e54 (
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
// Name: Asahel Lopez
// Date: 2/6/24
// Class: CST 116
// Assignment: InClassExercise9
#include <iostream>
#include "Node.h"
#include "PointerExercises.h"
void BasicReferencesAndVariables() {
int variable = 15;
int& ref = variable;
int* address = &variable;
ref++;
std::cout << variable << std::endl;
std::cout << address;
}
void DoublesNodeData(Node node)
{
node.data *= 2;
}
void DoublesNodeDataRef(Node& node) {
node.data *= 2;
}
void DoublesNodeData(Node* node){
node->data *= 2;
}
//Node* node = &newNode
#include "ReferenceExamples.h"
using std:: cout;
using std:: endl;
int main() {
//BasicReferencesAndVariables();
Node newNode{};
newNode.data = 32;
//std::cout << newNode.data << std::endl;
Node nextNode{};
nextNode.data = 438;
newNode._next = &nextNode;
//cout << newNode._next->data << endl;
Node* address = &newNode;
cout << address << endl;
address++;
cout << address << endl;
//int x = 5, y = 72;
//Swap(x, y);
//std::cout << "x = " << x << ", y = " << y << endl;
//int n = 4392;
//Standardize_101(n);
//cout << "Modded n = " << n << endl;
//Square(n);
//cout << "Squared n = " << n << endl;
//cout << " Size of an int" << sizeof(int);
Swap(&newNode, &nextNode);
Standardize_101(&newNode);
Square(&nextNode);
}
|