//Eric Bernal CS1A Chapter 6. P. 370, #7
//
/*******************************************************************************
* CONVERT TEMPERATURE MEASUREMENTS
* _____________________________________________________________________________
* This program converts temperature measurements, Fahrenheit to Celsius,
* based on a given number.
*
* Conversion is based on this formula:
* Celsius = 5/9(F-32)
* _____________________________________________________________________________
* Input
* Fahrenheit : Temperature as the Fahrenheit measurement
*
* Output
* Celsius : Temperature as the Celsius measurement.
******************************************************************************/
#include <iostream>
#include <iomanip>
using namespace std;
// Declare Function Prototype
float celsius(int Fahrenheit);
int main() {
// Data Dictionary - Initialize all Variables
float Fahrenheit = 0; //Input : Temperature as the Fahrenheit measurement
// Create temperature table - Display to output
cout << fixed << showpoint << setprecision(3);
for (Fahrenheit; Fahrenheit <= 20; Fahrenheit++)
{
cout << Fahrenheit << " degrees in Fahrenheit is equal to "
<< celsius(Fahrenheit) << " degrees Celsius." << endl;
// FUNCTION CALL ^
}
return 0;
}
/*******************************************************************************
* The following function's purpose is to convert Fahrenheit to Celsius.
******************************************************************************/
// Function Header + Conversion formula
float celsius(int Fahrenheit)
{
return(5.0/9.0) * (Fahrenheit - 32);
}