// *******************************************************************
//  Jeff Balsley  10/15/2001
//
//  Assignment: Write a program that invokes a function to convert 
//  a temperature the user enters in Fahrenheit to Celsius. 
//  (Celsius = 5/9 (Fahrenheit - 32). Display both the Fahrenheit 
//  and Celsius temperatures with 3 digits of precision in two side 
//  by side columns
//
// *******************************************************************
//  Known Bugs:
//
// *******************************************************************

#include <iostream>
using namespace std;

double fahrenheit_to_celsius(double temp_f);

int main()
{
	double temp_c;  
	double temp_f;

	do {
		cout << "Enter a temerature in fahrenheit >";
		cin >> temp_f;
		if (temp_f < -459 ){
			cout << "*** That temperature is not possible! ***\n";
		}
	} while (temp_f < -459);
	
	temp_c = fahrenheit_to_celsius(temp_f);

	cout.setf(ios_base::left);
	cout.precision(3);
	//cout.setf(ios::fixed);
	
	cout << "---------------------\n";
	cout << "fahrenheit | celsius \n";
	cout << "---------------------\n";
	cout.width(12);
	cout << temp_f;
	cout << temp_c << "\n";
	cout << "---------------------\n";

	return 0;
}

double fahrenheit_to_celsius(double temp_f)
{
	return( (5.0/9.0) * (temp_f -32 ) );
}