forked from strang3-r/Leetcode75
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTemperatureConversion.cpp
More file actions
33 lines (28 loc) · 855 Bytes
/
TemperatureConversion.cpp
File metadata and controls
33 lines (28 loc) · 855 Bytes
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
#include <iostream>
using namespace std;
int main() {
float kelvin;
int celcuis;
int c;
cout << "Please enter if you want to enter the value of temp in 1(for Kelvin "
"to celsuis) and 2(for celcuis to kelvin)";
cin >> c;
switch (c) {
case 1:
cout << "Please Enter The Tempratue in Kelvin : ";
cin >> kelvin;
cout << "The Tempratue in Celsius is : " << kelvin - 274.15 << 'C' << endl;
cout << "The approx value in int is : " << int(kelvin - 274.15) << 'C';
break;
case 2:
cout << "Please Enter The Tempratue in Celsius : ";
cin >> celcuis;
cout << "The Tempratue in Kelvin is : " << celcuis + 274.15 << 'k' << endl;
cout << "The approx value in Celcuis is : " << int(celcuis + 274.15) << 'k';
break;
default:
cout << "Please Enter A valid value : ";
break;
}
return 0;
}