aboutsummaryrefslogtreecommitdiff
path: root/InClassExercise 9/program.cpp
diff options
context:
space:
mode:
authorAsahel <[email protected]>2024-02-12 09:14:39 -0800
committerAsahel <[email protected]>2024-02-12 09:14:39 -0800
commit73f07ebff7508d9c84a057de5aed162ac1c3da32 (patch)
tree19f2da57f25ea19cd8b3840d80995dea367f4b17 /InClassExercise 9/program.cpp
parentCompleted assignment. (diff)
downloadin-class-exercise-9-asahellt-73f07ebff7508d9c84a057de5aed162ac1c3da32.tar.xz
in-class-exercise-9-asahellt-73f07ebff7508d9c84a057de5aed162ac1c3da32.zip
Not sure if I commited. Making sure.
Diffstat (limited to 'InClassExercise 9/program.cpp')
-rw-r--r--InClassExercise 9/program.cpp82
1 files changed, 73 insertions, 9 deletions
diff --git a/InClassExercise 9/program.cpp b/InClassExercise 9/program.cpp
index 0339535..ab09232 100644
--- a/InClassExercise 9/program.cpp
+++ b/InClassExercise 9/program.cpp
@@ -4,27 +4,91 @@
// 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() {
- int x = 5, y = 72;
- Swap(x, y);
+ //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;
- std::cout << "x = " << x << ", y = " << y << endl;
+ //int n = 4392;
- int n = 4392;
+ //Standardize_101(n);
- Standardize_101(n);
+ //cout << "Modded n = " << n << endl;
- cout << "Modded n = " << n << endl;
+ //Square(n);
- Square(n);
+ //cout << "Squared n = " << n << endl;
- cout << "Squared n = " << n << endl;
+ //cout << " Size of an int" << sizeof(int);
- cout << " Size of an int" << sizeof(int);
+ Swap(&newNode, &nextNode);
+ Standardize_101(&newNode);
+ Square(&nextNode);
} \ No newline at end of file