Source Code for Lab #3
//
// lab03.cpp. This program reads a temperature in Fahrenheit
// and calculates the equivalent Celsius temperature.
//
#include <iostream>
using namespace std ;
int F_to_C(int Fahrenheit); // prototype
int main(void)
{
int Fahrenheit, // temperature in Fahrenheit
Celsius; // temperature in Celsius
cout << "This program converts a temperature in" << endl ;
cout << "Fahrenheit to Celsius and vice versa." << endl ;
cout << "All measurements are in whole numbers." << endl << endl ;
cout << "Please enter a Fahrenheit temperature: ";
cin >> Fahrenheit;
Celsius = F_to_C(Fahrenheit);
cout << Fahrenheit << " degrees Fahrenheit = "
<< Celsius << " degrees Celsius" << endl ;
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 ***//
}