aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConnor McDowell <[email protected]>2024-02-08 16:10:40 -0800
committerConnor McDowell <[email protected]>2024-02-08 16:10:40 -0800
commit624653ec3923df0314b22d1793e456ca19ccc810 (patch)
tree7b4e8e2a4c21602824af8b26d618d00816d8c396
parenti literally have NO idea what to do. all i get is the addresses when the assi... (diff)
downloadin-class-exercise-10-connormcdowell275-624653ec3923df0314b22d1793e456ca19ccc810.tar.xz
in-class-exercise-10-connormcdowell275-624653ec3923df0314b22d1793e456ca19ccc810.zip
OHMYGOD I FIGURED IT OUT
-rw-r--r--Inclass 10/PointerExamples.cpp21
-rw-r--r--Inclass 10/program.cpp4
2 files changed, 14 insertions, 11 deletions
diff --git a/Inclass 10/PointerExamples.cpp b/Inclass 10/PointerExamples.cpp
index 16de9c3..0511482 100644
--- a/Inclass 10/PointerExamples.cpp
+++ b/Inclass 10/PointerExamples.cpp
@@ -8,20 +8,19 @@ using std::endl;
void Swap(Node* first, Node* second)
{
- int test = 0;
- int test2 = 0;
- first->data = test;
- second->data = test2;
-
-
- cout << "first node swapped is (correct 16): " << second << " the second node swapped is (correct 24): " << first << endl;
+ int test;
+ test = first->data;
+ first->data = second->data;
+ second->data = test;
+
+ cout << test << endl;
+
}
-void Standardize_101(Node* thirdNode)
+void Standardize_101(Node* newNode)
{
- /*int stan = 0;
- Node* thirdNode = stan;
- thirdNode->_data = stan;*/
+ newNode->data % 101;
+
}
diff --git a/Inclass 10/program.cpp b/Inclass 10/program.cpp
index 59231d5..ce6fc87 100644
--- a/Inclass 10/program.cpp
+++ b/Inclass 10/program.cpp
@@ -27,8 +27,12 @@ int main()
Swap(&newNode, &nextNode);
+ cout << "first node swapped is: " << newNode.data << " the second node swapped is : " << nextNode.data << endl;
+
Standardize_101(&newNode);
+ cout << newNode.data << endl;
+
Square(&nextNode);
return 0;