/*
Name: Mike Elms
Date: 3/1/2007
Program: Tempature.cpp
Purpose: To convert celsius to fahrenheit and to convert fahrenheit
to celsius.
Test Plan:
Test 1
Enter the temperature in celsius: 100
The temperature in fahrenheit is 212
Enter the temperature in fahrenheit: 212
The temperature in celsius is 100
Test 2
Enter the temperature in celsius: 0
The temperature in fahrenheit is 32
Enter the temperature in fahrenheit: 32
The temperature in celsius is 0
Test 3
Enter the temperature in celsius: 27
The temperature in fahrenheit is 80.6
Enter the temperature in fahrenheit: 80.6
The temperature in celsius is 27
*/
#include < iostream >
using namespace std;
int myProcedure()
{
double celsius;
double fahrenheit;
//Get the temperature in celsius
cout << "Enter the temperature in celsius: ";
cin >> celsius;
//Convert the temperature to fahrenheit
fahrenheit = (celsius*(9.0/5.0))+32;
//Display the temperature in fahrenheit
cout << "The temperature in fahrenheit is " << fahrenheit << endl;
cout << "Enter the temperature in fahrenheit: ";
cin >> fahrenheit;
//Convert the temperature to celsius
celsius = ((fahrenheit-32)*(5.0/9.0));
//Display the temperature in celsius
cout << "The temperature in celsius is " << celsius << endl;
return 0;
} // end myProcedure()
double myCelsius(double f)
{
double c;
cout << "myCelsius(" << f << ")" << endl;
c = ((f-32)*(5.0/9.0));
return c;
} // end myCelsius(double f)
double myFahrenheit(double c)
{
double f;
cout << "myFahrenheit(" << c << ")" << endl;
f = (c*(9.0/5.0))+32;
return f;
} // end myFahrenheit(double c)
int myFunction()
{
double celsius;
double fahrenheit;
cout << "myFunction()" << endl;
cout << "Enter the temperature in celsius: ";
cin >> celsius;
fahrenheit = myFahrenheit(celsius);
cout << "The temperature in fahrenheit is " << fahrenheit << endl;
cout << "Enter the temperature in fahrenheit: ";
cin >> fahrenheit;
celsius = myCelsius(fahrenheit);
cout << "The temperature in celsius is " << celsius << endl;
return 0;
} // end myFunction()
int main()
{
myProcedure();
myFunction();
return 0;
} // end main()