aboutsummaryrefslogtreecommitdiff
path: root/inclass-Extercise6
diff options
context:
space:
mode:
Diffstat (limited to 'inclass-Extercise6')
-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