Example Program to convert a temperature from Celsius to Fahrenheit
Source:
/**********************************************************************/
/* */
/* File: Fahrenheit.cpp */
/* Author: Mike Elms */
/* Date: 2/4/2012 */
/* Purpose: To convert a temperature from Celsius to Fahrenheit */
/* */
/**********************************************************************/
#include <iostream>
using namespace std;
int main()
{
double f;
double c;
cout << "Begin" << endl << endl;
cout << "Enter a temperature in Celsius: ";
cin >> c;
f = (c*(9.0/5.0))+32;
cout << "Fahrenheit: " << f << endl;
cout << endl;
cout << "End" << endl;
return 0;
}
Output
Test Run 1
Begin
Enter a temperature in Celsius: 0
Fahrenheit: 32
End
Test Run 2
Begin
Enter a temperature in Celsius: 100
Fahrenheit: 212
End