From 807fee1cdb7e4dcef67a1ae4084c2901f9814551 Mon Sep 17 00:00:00 2001 From: Yana Blashchishina Date: Wed, 7 Feb 2024 14:00:04 -0800 Subject: completed --- InClassExercise9/InClassExercise9/ReferenceExamples.cpp | 8 +++++--- InClassExercise9/InClassExercise9/program.cpp | 16 ++++++++++++---- 2 files changed, 17 insertions(+), 7 deletions(-) (limited to 'InClassExercise9') 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 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 -- cgit v1.2.3