Source Code for Lab #3
//
// LAB031.cpp. This program reads a temperature in Fahrenheit
// and calculates the equivalent Celsius temperature.
//
#include <iostream.h>
int main(void)
{
int F_to_C(int Fahrenheit); // prototype
int Fahrenheit, // temperature in Fahrenheit
Celsius; // temperature in Celsius
cout << "This program converts a temperature in\n";
cout << "Fahrenheit to Celsius and vice versa.\n";
cout << "All measurements are in whole numbers.\n\n";
cout << "Please enter a Fahrenheit temperature: ";
cin >> Fahrenheit;
Celsius = F_to_C(Fahrenheit);
cout << Fahrenheit << " degrees Fahrenheit = "
<< Celsius << " degrees Celsius\n";
return 0;
}
//
// Given an integer Fahrenheit degree measurement, this
// function returns the corresponding integer Celsius
// measurement.
// Pre: Fahrenheit is an integer.
// Post: The function has returned the corresponding
// integer Celsius measurement.
//
int F_to_C(int Fahrenheit)
{
//*** Fill in ***//
}