aboutsummaryrefslogtreecommitdiff
path: root/Project1/program.cpp
diff options
context:
space:
mode:
authoraustinlujan <[email protected]>2024-03-19 00:21:47 -0700
committeraustinlujan <[email protected]>2024-03-19 00:21:47 -0700
commitd245d5794be59d0ec8fae011e3623436d9d40658 (patch)
tree5a604fdc404228e30445b1889882fb1643e99303 /Project1/program.cpp
parentadd deadline (diff)
downloadin-class-exercise-5-austinlujan-main.tar.xz
in-class-exercise-5-austinlujan-main.zip
implemented and tested exercise 5 functionsHEADmain
Diffstat (limited to 'Project1/program.cpp')
-rw-r--r--Project1/program.cpp71
1 files changed, 71 insertions, 0 deletions
diff --git a/Project1/program.cpp b/Project1/program.cpp
new file mode 100644
index 0000000..2aec9cb
--- /dev/null
+++ b/Project1/program.cpp
@@ -0,0 +1,71 @@
+// Name: Austin Lujan
+// Date: 1/16
+// Class: CST 116
+// Assignment: Exercise 5
+
+#include <iostream>
+#include "helpers.h"
+
+
+
+int main()
+{
+ int mySum = sum(15, 30);
+
+ std::cout << mySum << std::endl;
+
+ std::cout << returnInt() << std::endl;
+
+ std::cout << percentage(10, 100) << std::endl;
+ std::cout << percentage(25, 100) << std::endl;
+ std::cout << percentage(35, 100) << std::endl;
+ std::cout << percentage(780, 100) << std::endl;
+
+ int i;
+ std::cin >> i;
+ std::cout << FtoC(i) << std::endl;
+ std::cout << CtoF(i) << std::endl;
+ return 0;
+}
+
+int sum(int a, int b)
+{
+ int sum = 0;
+
+ sum = a + b;
+
+ return sum;
+}
+
+int returnInt()
+{
+
+ return 10;
+}
+
+float percentage(int a, int b)
+{
+ float perc = ((float(a) / b)) * 100;
+
+ return perc;
+}
+
+float FtoC(int fah)
+{
+ // -32*5/9
+
+ float num = (fah - 32) * (5 / 9);
+
+ return num;
+}
+
+float CtoF(int cel)
+{
+ // 9/5+32
+
+ float num = (cel * (9.0 / 5.0)) + 32;
+
+ return num;
+}
+
+