My program makes the first conversion and then stops!
Can you see where I am going wrong?
#include<iostream>
#include<cmath>
#include<iomanip>
using namespace std;
double Tempconversion(double Tc);
int main()
{double Tc, Tf(0);
cout << "Enter a starting temperature for Celcius: ";
cout << fixed;
cin >> Tc;
cout << " \n Celcius Farenheit" << endl;
for (double celcius=0; celcius<=20; celcius++)
{
cout << setw(8) << setprecision(4) << Tc <<
setw(18) << setprecision(4) << Tempconversion(Tf) << endl;
return 0;
}}
double Tempconversion(double Tc)
{double Tf;
Tf = (((9/5) * Tc) + 32);
return Tf;
}
Inside the loop you have return 0;
so you will only run what's inside the loop once.
change Tempconversion (Tf) to Tempconversion (Tc).