ok, sorry for all the confusion, I figured it out on my own, but now I ran into a new problem:
when i use C, everything is line to line back to back
but if I use F, a line is skipped b/t the lines
If you copy past this, it WILL work now.
Code:
#include <iostream>
#include <iomanip>
using namespace std;
void convert (int tempmin, int tempmax, char ForC);
int main ()
{
int tempmin, tempmax;
char ForC;
cout << "You have selected the conversion option.\n"
<< "Enter the starting range.\n";
cin >> tempmin;
cout << "Enter the ending range.\n";
cin >> tempmax;
cout << "Enter C to convert from celsius to fahrenheit or,\n"
<< "Enter F to convert from fahrenheit to celsius.\n";
cin >> ForC;
convert (tempmin, tempmax, ForC);
return 0;
}
void convert (int tempmin, int tempmax, char ForC)
{
if (ForC == 'C' || ForC == 'c') {
const int step = 1;
double fahren;
int celsius;
cout << "Degree Degrees\n"
<< "Celsius Fahrenheit\n"
<< "------- ----------\n";
celsius = tempmin;
cout << setiosflags (ios :: showpoint) << setiosflags (ios :: fixed)
<< setprecision (2);
while (celsius <=tempmax)
{
fahren = (9.0/5.0) * celsius + 32.0; cout << setw (4) << celsius
<< setw (13) << fahren << endl; celsius = celsius + step;
}
}
else if (ForC == 'f' || ForC == 'F')
{
const int increase = 1;
int fahren;
double celsius;
cout << "Degree Degrees\n"
<< "Fahrenheit Celsius\n"
<< "------ -------\n";
fahren = tempmin;
cout << setiosflags (ios :: showpoint) << setiosflags (ios :: fixed) << setprecision (2);
while (fahren <=tempmax)
{
celsius = (fahren-32) *(5.0/9.0);
cout << setw (4) << fahren
<< setw (13) << celsius << endl;
fahren = fahren + increase;
cout << endl;
}
}
}