diff options
| author | raquelc <[email protected]> | 2024-01-25 22:04:19 -0800 |
|---|---|---|
| committer | raquelc <[email protected]> | 2024-01-25 22:04:19 -0800 |
| commit | ce09516e97ba819c8e9e67426b3e27483fa614c6 (patch) | |
| tree | ffe0f2d6d4ffed68c5ef12f7d0b2623aeda4b341 | |
| parent | setup of pages (diff) | |
| download | in-class-exercise-6-raquel191-ce09516e97ba819c8e9e67426b3e27483fa614c6.tar.xz in-class-exercise-6-raquel191-ce09516e97ba819c8e9e67426b3e27483fa614c6.zip | |
| -rw-r--r-- | inclass-Extercise6/inclass-Extercise6/Header.h | 6 | ||||
| -rw-r--r-- | inclass-Extercise6/inclass-Extercise6/Source.cpp | 27 |
2 files changed, 33 insertions, 0 deletions
diff --git a/inclass-Extercise6/inclass-Extercise6/Header.h b/inclass-Extercise6/inclass-Extercise6/Header.h index c31c3d7..31ba7af 100644 --- a/inclass-Extercise6/inclass-Extercise6/Header.h +++ b/inclass-Extercise6/inclass-Extercise6/Header.h @@ -1,7 +1,13 @@ #ifndef MY_HEADER_FILE_H #define MY_HEADER_FILE_H +int math_func(); +// three overloads +int math_func(int square); +int math_func(int a, int b); + +int math_func(int A, int B, int C, int x = 2); #endif diff --git a/inclass-Extercise6/inclass-Extercise6/Source.cpp b/inclass-Extercise6/inclass-Extercise6/Source.cpp index 52abe43..3c11aad 100644 --- a/inclass-Extercise6/inclass-Extercise6/Source.cpp +++ b/inclass-Extercise6/inclass-Extercise6/Source.cpp @@ -3,8 +3,35 @@ //Class: CST 116 #include <iostream> +#include "Header.h" int main() { + std::cout << math_func() << std::endl; + + std::cout << math_func(2) << std::endl; + + std::cout << math_func(2, 4) << std::endl; + + std::cout << math_func(5, 7, 8) << std::endl; + return 0; +} + + +int math_func() { + return 1; +} + +// three overloads +int math_func(int square) { + return square * square; +} + +int math_func(int a, int b) { + return a + b; +} + +int math_func(int A, int B, int C, int x) { + return (A * x * x) - (B * x) + C; }
\ No newline at end of file |