diff options
| author | Yana Blashchishina <[email protected]> | 2024-02-07 14:00:04 -0800 |
|---|---|---|
| committer | Yana Blashchishina <[email protected]> | 2024-02-07 14:00:04 -0800 |
| commit | 807fee1cdb7e4dcef67a1ae4084c2901f9814551 (patch) | |
| tree | 6a2519ed6be3f01ea02e3fceb9061c1dd3b40750 | |
| parent | init (diff) | |
| download | in-class-exercise-9-yanablash-807fee1cdb7e4dcef67a1ae4084c2901f9814551.tar.xz in-class-exercise-9-yanablash-807fee1cdb7e4dcef67a1ae4084c2901f9814551.zip | |
| -rw-r--r-- | InClassExercise9/InClassExercise9/ReferenceExamples.cpp | 8 | ||||
| -rw-r--r-- | InClassExercise9/InClassExercise9/program.cpp | 16 |
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 |