-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConvert-Fahrenheit-to-Celsius-v2.cpp
More file actions
59 lines (37 loc) · 1.48 KB
/
Convert-Fahrenheit-to-Celsius-v2.cpp
File metadata and controls
59 lines (37 loc) · 1.48 KB
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
58
59
//Homework due 2/12/2016
//Purpose: Write an interactive program to convert Fahrenheit to Celsius
//Author: Larsen J Close Most recent changes: 2/12/2016
//F= (C * 1.8)+32
//C= ((F-32)/1.8)
//fahrenheit = (celsius * 9.0) / 5.0 + 32
//Celsius = (((Fahrenheit - 32 ) * 5 )/9)
//fahrenheit = 9.0 / 5.0 * celsius + 32;
#include <iostream> // preprocessor directive
#include <iomanip> // needed for most manipulators
#include <cmath> // needed for sqrt()
using namespace std; // using directive
int main ( void )
{
double f;
double c;
cout << "This program converts a Fahrenheit temperature" << endl;
cout << "to its Celsius equivalent." << endl;
cout << "Enter a Fahrenheit temperature:";
cin >> f;
c = (f - 32)/ 1.8;
cout << f << " degrees Fahrenheit is the same as " << c << " degrees Celsius" << endl;
system ("pause");
return 0;
} //end main ( )
/* Display for above program
This program converts a Fahrenheit temperature
to its Celsius equivalent.
Enter a Fahrenheit temperature:212
212 degrees Fahrenheit is the same as 100 degrees Celsius
Press any key to continue . . .
This program converts a Fahrenheit temperature
to its Celsius equivalent.
Enter a Fahrenheit temperature:212
212 degrees Fahrenheit is the same as 100 degrees Celsius
Press any key to continue . . .
*/