forked from naroladhar/Cpp_progs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_1_Temp.cpp
More file actions
29 lines (28 loc) · 855 Bytes
/
_1_Temp.cpp
File metadata and controls
29 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
//
// Program to convert temperature from Celsius degree
// units into Fahrenheit degree units:
// Fahrenheit = Celsius * (212 - 32)/100 + 32
//
#include <cstdio>
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int nNumberofArgs, char* pszArgs[])
{
// enter the temperature in Celsius
int celsius,factor,fahrenheit;
cout<< "Enter the temperature in Celsius:";
cin >> celsius;
// calculate conversion factor for Celsius
factor = 212 - 32;
// use conversion factor to convert Celsius
// into Fahrenheit value
fahrenheit = factor * celsius/100 + 32;
// output the results (followed by a NewLine)
cout << "Fahrenheit value is:";
cout << fahrenheit << endl;
// wait until user is ready before terminating program
// to allow the user to see the program results
system("PAUSE");
return 0;
}