Upload files to "/"
This commit is contained in:
38
tempconv.cpp
Normal file
38
tempconv.cpp
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
//
|
||||||
|
// Conversion - 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 nCelsius;
|
||||||
|
cout << "Enter the temperature in Celsius:";
|
||||||
|
cin >> nCelsius;
|
||||||
|
|
||||||
|
// calculate conversion factor for Celsius
|
||||||
|
// to Fahrenheit
|
||||||
|
int nFactor;
|
||||||
|
nFactor = 212 - 32;
|
||||||
|
|
||||||
|
// use conversion factor to convert Celsius
|
||||||
|
// into Fahrenheit values
|
||||||
|
int nFahrenheit;
|
||||||
|
nFahrenheit = nFactor * nCelsius/100 + 32;
|
||||||
|
|
||||||
|
// output the results
|
||||||
|
cout << "Fahrenheit value is:";
|
||||||
|
cout << nFahrenheit;
|
||||||
|
cout << endl;
|
||||||
|
|
||||||
|
// wait until user is ready before terminating program
|
||||||
|
// system("PAUSE");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
Reference in New Issue
Block a user