//File: tempConvert
//Author: Jesse D
//Date: Feb. 26, 2007
//
//Description: This program uses two functions to convert from Fahrenheit to
// Celsius, and from Celsius to Fahreneit. THe results are
// printed to the screen.
//
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
void convertToFah(double a){
double fah;
fah = ((a * 9/5) + 32); //calculation
cout << setw(6) << a << setw(12) << fah <<endl; //output
}
void convertToCel(double a){
double cel;
cel = ((a - 32)* 5.0/9.0); //calculation
cout << setw(6) << a << setw(15) << cel <<endl; //output
}
int main()
{
double tempCel = 0;
double tempFah = 32;
cout << setw(10) << "Celsius" << setw(12) << "Fahrenheit" <<endl;
for (tempCel = 0; tempCel < 101; ){
convertToFah(tempCel);
tempCel++;
}
cout << endl;
cout << setw(10) << "Fahrenheit" << setw(10) << "Celsius" <<endl;
for (tempFah = 32; tempFah < 213; ){
convertToCel(tempFah);
tempFah++;
}
return 0;
}