aboutsummaryrefslogtreecommitdiff
path: root/homework2/homework2.cpp
blob: 9c2ac9d38b6aa9c31550c252d6509fb176f35871 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
// Author: Connor McDowell
// Date: 1/20/24
// project reason: Homework 2
#include <iostream>

int main()
{
	int a = 0;
	int b = 0;
	float fah = 0.0;
	float cel = 0.0;


	int sum(int a, int b);
	float percentage(int a, int b);
	float FtoC(int fah);
	float CtoF(int cel);

	std::cout << percentage(45, 78) << std::endl;
	std::cout << FtoC(120) << std::endl;
	std::cout << CtoF(40) << std::endl;
}

int sum(int a, int b)
{
	int sum = 0;
	sum = a + b;

	return sum;
}

float percentage(int a, int b)
{
	float perc = 0;
	perc = (static_cast<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;
}