aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorraquelc <[email protected]>2024-01-25 22:04:19 -0800
committerraquelc <[email protected]>2024-01-25 22:04:19 -0800
commitce09516e97ba819c8e9e67426b3e27483fa614c6 (patch)
treeffe0f2d6d4ffed68c5ef12f7d0b2623aeda4b341
parentsetup of pages (diff)
downloadin-class-exercise-6-raquel191-main.tar.xz
in-class-exercise-6-raquel191-main.zip
completed extercise 6HEADmain
-rw-r--r--inclass-Extercise6/inclass-Extercise6/Header.h6
-rw-r--r--inclass-Extercise6/inclass-Extercise6/Source.cpp27
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