summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConnor McDowell <[email protected]>2024-01-27 15:22:32 -0800
committerConnor McDowell <[email protected]>2024-01-27 15:22:32 -0800
commit8771e43a12d4a704f6a08ed6b16def0686fce30d (patch)
tree11f517bd40bb50e8e6e60ceb5a45fa9276ef0062
parenttesting two (diff)
downloadin-class-exercise-6-connormcdowell275-8771e43a12d4a704f6a08ed6b16def0686fce30d.tar.xz
in-class-exercise-6-connormcdowell275-8771e43a12d4a704f6a08ed6b16def0686fce30d.zip
Inclass 6 overload functions created, problem with math_func() (return 1) will troubleshoot.
-rw-r--r--.vs/in-class-exercise-6-connormcdowell275/v17/.wsuobin34816 -> 34816 bytes
-rw-r--r--.vs/in-class-exercise-6-connormcdowell275/v17/Browse.VC.dbbin10870784 -> 10870784 bytes
-rw-r--r--.vs/slnx.sqlitebin323584 -> 323584 bytes
-rw-r--r--Project1/header.h10
-rw-r--r--Project1/inclass6.cpp49
5 files changed, 22 insertions, 37 deletions
diff --git a/.vs/in-class-exercise-6-connormcdowell275/v17/.wsuo b/.vs/in-class-exercise-6-connormcdowell275/v17/.wsuo
index ab16c48..cc982f2 100644
--- a/.vs/in-class-exercise-6-connormcdowell275/v17/.wsuo
+++ b/.vs/in-class-exercise-6-connormcdowell275/v17/.wsuo
Binary files differ
diff --git a/.vs/in-class-exercise-6-connormcdowell275/v17/Browse.VC.db b/.vs/in-class-exercise-6-connormcdowell275/v17/Browse.VC.db
index 13424b1..5f4c9ec 100644
--- a/.vs/in-class-exercise-6-connormcdowell275/v17/Browse.VC.db
+++ b/.vs/in-class-exercise-6-connormcdowell275/v17/Browse.VC.db
Binary files differ
diff --git a/.vs/slnx.sqlite b/.vs/slnx.sqlite
index 79ce157..c988af3 100644
--- a/.vs/slnx.sqlite
+++ b/.vs/slnx.sqlite
Binary files differ
diff --git a/Project1/header.h b/Project1/header.h
index a172276..de29a83 100644
--- a/Project1/header.h
+++ b/Project1/header.h
@@ -1,14 +1,12 @@
#ifndef MY_HEADER_FILE_H
#define MY_HEADER_FILE_H
-int returnInt();
+int math_func();
-int sum(int a, int b);
+int math_func(int square = 2);
-float percentage(int a, int b);
+int math_func(int a, int b);
-float FtoC(int fah);
-
-float CtoF(int cel);
+int math_func(int A, int B, int C, int = 2);
#endif MY_HEADER_FILE_H \ No newline at end of file
diff --git a/Project1/inclass6.cpp b/Project1/inclass6.cpp
index 9f178b6..ead6f80 100644
--- a/Project1/inclass6.cpp
+++ b/Project1/inclass6.cpp
@@ -1,7 +1,7 @@
// Name: Connor McDowell
-// Date: 1/22/2024
+// Date: 1/27/2024
// Class: CST116
-// Assignment: exercise 5
+// Assignment: exercise 6
#include <iostream>
@@ -9,55 +9,42 @@
int main()
{
- int mySum = sum(15, 30);
- std::cout << mySum << std::endl;
+ std::cout << math_func() << std::endl;
- std::cout << returnInt() << std::endl;
+ std::cout << math_func(2) << std::endl;
- std::cout << percentage(45, 78) << std::endl;
- std::cout << FtoC(120) << std::endl;
- std::cout << CtoF(40) << std::endl;
- std::cout << returnInt() << std::endl;
-}
+ std::cout << math_func(2, 4) << std::endl;
-int returnInt()
-{
+ std::cout << math_func(5, 7, 8) << std::endl;
- return 10;
+ return 0;
}
-int sum(int a, int b)
+int math_func()
{
- int sum = 0;
- sum = a + b;
- return sum;
+ return 1;
}
-float percentage(int a, int b)
+int math_func(int square)
{
- int perc = 0;
- perc = (static_cast<float>(a) / b) * 100;
- return perc;
-}
+ return square * square;
+}
-float FtoC(int fah)
+int math_func(int a, int b)
{
- // -32*5/9
- float num = (fah - 32) * (5 / 9);
- return num;
+ return a + b;
}
-float CtoF(int cel)
+int math_func(int A, int B, int C, int x)
{
- // 9/5+32
- float num = (cel * (9.0 / 5.0)) + 32;
- return num;
-} \ No newline at end of file
+ return (A * x * x) - (B * x) + C;
+}
+