aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYana Blashchishina <[email protected]>2024-01-25 16:16:31 -0800
committerYana Blashchishina <[email protected]>2024-01-25 16:16:31 -0800
commit5b27d8b748d058b004e7725c5116bf3fb7be0200 (patch)
tree0e3684cf7cb01ba7eed648b2341156b87a8a7a58
parentinit (diff)
downloadin-class-exercise-5-yanablash-5b27d8b748d058b004e7725c5116bf3fb7be0200.tar.xz
in-class-exercise-5-yanablash-5b27d8b748d058b004e7725c5116bf3fb7be0200.zip
exercise 5 complete pls work
-rw-r--r--InExercise5/InExercise5/source.cpp80
1 files changed, 79 insertions, 1 deletions
diff --git a/InExercise5/InExercise5/source.cpp b/InExercise5/InExercise5/source.cpp
index 32686ff..853ae15 100644
--- a/InExercise5/InExercise5/source.cpp
+++ b/InExercise5/InExercise5/source.cpp
@@ -2,4 +2,82 @@
// Name: Yana Blashchishina
// Date: 01/25/2024
// Class: CST116
-// Assignment: Exercise 5 \ No newline at end of file
+// Assignment: Exercise 5
+
+#include <iostream>
+
+#include "helper.h"
+
+
+int main()
+{
+
+ sum(15, 30);
+
+ std::cout << sum(15, 30) << std::endl;
+
+ std::cout << returnInt() << std::endl;
+
+ std::cout << percentage(10, 100) << "%" << std::endl;
+ std::cout << percentage(25, 100) << std::endl;
+ std::cout << percentage(30, 300) << 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 = (static_cast<float>(a) / b) * 100;
+
+
+ return perc;
+}
+
+float FtoC(int fah) {
+ // -31*5/9
+
+ float num = (fah - 32) * (5.0 / 9.0);
+
+ return num;
+}
+
+float CtoF(int cel) {
+ // 9/5+32
+
+ float num = (cel * (9.0 / 5.0)) + 32;
+
+ return num;
+}
+
+
+long factorial(int a)
+{
+ if (a == 0 || a == 1)
+ return 1; //base case returns solid data
+ else
+ return a * factorial(a - 1); //recursive case: a! = a * (a- 1)!
+
+
+} \ No newline at end of file