aboutsummaryrefslogtreecommitdiff
path: root/In Class Exercise 6
diff options
context:
space:
mode:
authorMiles-Cell <[email protected]>2024-03-04 13:18:35 -0800
committerMiles-Cell <[email protected]>2024-03-04 13:18:35 -0800
commitec0b1d23572c594e35da962567c42c8e9ddcd645 (patch)
tree7e1bc6b7a15179a702a967693fe46389b4d9b135 /In Class Exercise 6
parentRe-committing completed exercise. Location fixed. (diff)
downloadin-class-exercise-6-miles-cell-ec0b1d23572c594e35da962567c42c8e9ddcd645.tar.xz
in-class-exercise-6-miles-cell-ec0b1d23572c594e35da962567c42c8e9ddcd645.zip
Exercise completed, fixed and pushed.
Diffstat (limited to 'In Class Exercise 6')
-rw-r--r--In Class Exercise 6/In Class Exercise 6/Header.h48
-rw-r--r--In Class Exercise 6/In Class Exercise 6/Source.cpp111
2 files changed, 25 insertions, 134 deletions
diff --git a/In Class Exercise 6/In Class Exercise 6/Header.h b/In Class Exercise 6/In Class Exercise 6/Header.h
index 5d18f82..2d68e0a 100644
--- a/In Class Exercise 6/In Class Exercise 6/Header.h
+++ b/In Class Exercise 6/In Class Exercise 6/Header.h
@@ -1,33 +1,27 @@
#ifndef MAIN_H
#define MAIN_H
-// Content of the header file
-int return_int();
-
-int sum(int a, int b);
-
-int sum(int a, int b, int c, int d);
-
-int sum(float a);
-
-float percentage(int a, int b);
-
-float f_t_c(int fah);
-
-float c_t_f(int cel);
-
-int math_func();
-
-int math_func(int square);
-
-int math_func(int a, int b);
-
-int math_func(int A, int B, int C, int x = 2);
-
-
-
-
-long factorial(int a);
+#include <iostream>
+
+int math()
+{
+ return 0;
+}
+
+int math(int x)
+{
+ return x * x;
+}
+
+int math(int x, int y)
+{
+ return x + y;
+}
+
+int math(int A, int B, int C, int x = 2)
+{
+ return A * x * x - B * x + C;
+}
#endif MAIN_H \ No newline at end of file
diff --git a/In Class Exercise 6/In Class Exercise 6/Source.cpp b/In Class Exercise 6/In Class Exercise 6/Source.cpp
index cd22830..40dc040 100644
--- a/In Class Exercise 6/In Class Exercise 6/Source.cpp
+++ b/In Class Exercise 6/In Class Exercise 6/Source.cpp
@@ -5,121 +5,18 @@
#include <iostream>
-
#include "Header.h"
-
int main()
{
- //std::cout << sum(15, 300) << std::endl;
- /*std::cout << return_int() << std::endl;
- std::cout << percentage(10, 100) << "%" << std::endl;
- std::cout << percentage(25, 100) << "%" << std::endl;
- std::cout << percentage(30, 100) << "%" << std::endl;
- std::cout << percentage(780, 100) << "%" << std::endl;
- int i;
- std::cin >> i;
- std::cout << f_t_c(i) << std::endl;
- std::cout << c_t_f(i) << std::endl;*/
- //std::cout << sum(10, 15, 32, 56);
- //std::cout << sum(15);
- //sum(sum1, sum(65, 25));
-
- 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;
-
+ std::cout << math() << std::endl;
+ std::cout << math(5) << std::endl;
+ std::cout << math(3, 7) << std::endl;
+ std::cout << math(1, -4, 4) << std::endl;
return 0;
}
-int math_func() {
- return 1;
-}
-
-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;
-}
-
-
-
-
-
-
-
-
-
-
-
-int sum(float a)
-{
- return a * 10;
-}
-
-int sum(int a, int b)
-{
- int sum = 0;
-
- sum = a + b;
-
- return sum;
-}
-
-int sum(int a, int b, int c, int d)
-{
- //int add = a + b + c + d;
-
- return a + b + c + d;
-}
-
-
-int return_int()
-{
-
- return 10;
-}
-
-
-float percentage(int a, int b)
-{
-
- float perc = (static_cast<float>(a) / b) * 100;
-
- return perc;
-}
-
-
-float f_t_c(int fah)
-{
- // -32*5/9
-
- float num = (fah - 32) * (5.0 / 9.0);
-
- return num;
-}
-
-float c_t_f(int cel)
-{
- // 9/5+32
-
- float num = (cel * (9.0 / 5.0)) + 32;
-
- return num;
-}
-
-