-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProject3.cpp
30 lines (24 loc) · 878 Bytes
/
Project3.cpp
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
#include <iostream>
int main () {
double temp;
char unit;
std::cout << "****** Temperature conversion ******\n";
std::cout << "F = Fahrenheit\n";
std::cout << "C = Celsius\n";
std::cout << "What unit would you like to convert to: ";
std::cin >> unit;
if( unit == 'F' || unit == 'f') {
std::cout << "Enter the temperature in Celsius: ";
std::cin >> temp;
temp = (1.8 * temp) + 32.0;
std::cout << "temperature is: " << temp << "F\n";
} else if ( unit == 'C' || unit == 'c') {
std::cout << "Enter the temperature in Fahrenheit: ";
std::cin >> temp;
temp = (temp - 32) / 1.8;
std::cout << "temperature is: " << temp << "C\n";
} else {
std::cout << "Please enter in only C or F\n";
}
std::cout << "************************************\n";
}