diff --git a/tempconv.cpp b/tempconv.cpp new file mode 100644 index 0000000..465ed45 --- /dev/null +++ b/tempconv.cpp @@ -0,0 +1,38 @@ +// +// Conversion - convert temperature from Celsius +// degree units into Fahrenheit degree +// units: +// Fahrenheit = Celsius * (212 - 32)/100 + 32 +// +#include +#include +#include +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; +} +