aboutsummaryrefslogtreecommitdiff
path: root/InClassExercise9/InClassExercise9
diff options
context:
space:
mode:
Diffstat (limited to 'InClassExercise9/InClassExercise9')
-rw-r--r--InClassExercise9/InClassExercise9/ReferenceExamples.cpp8
-rw-r--r--InClassExercise9/InClassExercise9/program.cpp16
2 files changed, 17 insertions, 7 deletions
diff --git a/InClassExercise9/InClassExercise9/ReferenceExamples.cpp b/InClassExercise9/InClassExercise9/ReferenceExamples.cpp
index b19b7b7..26381bf 100644
--- a/InClassExercise9/InClassExercise9/ReferenceExamples.cpp
+++ b/InClassExercise9/InClassExercise9/ReferenceExamples.cpp
@@ -2,13 +2,15 @@
#include "ReferenceExamples.h"
void Swap(int& x, int& y) {
-
+ int temp = x;
+ x = y;
+ y = temp;
}
void Standardize_101(int& n) {
-
+ n %= 101;
}
void Square(int& x) {
-
+ x *= x;
}
diff --git a/InClassExercise9/InClassExercise9/program.cpp b/InClassExercise9/InClassExercise9/program.cpp
index c87b4f0..c16d325 100644
--- a/InClassExercise9/InClassExercise9/program.cpp
+++ b/InClassExercise9/InClassExercise9/program.cpp
@@ -1,3 +1,8 @@
+// Name: Yana Blashchishina
+// Date: 2/5/2024
+// Class: CST116
+// Assignment: Exercise 9
+
#include "ReferenceExamples.h"
#include <iostream>
using std::cout;
@@ -12,21 +17,24 @@ int main() {
std::cout << "x = " << x << ", y = " << y << endl;
+
+
+
int n = 4392;
Standardize_101(n);
cout << "Moded n = " << n << endl;
+
+
Square(n);
cout << "Squared n = " << n << endl;
cout << "Size of an int " << sizeof(int);
+
-
-
-
-
+ return 0;
} \ No newline at end of file