Im new to C++ so I am trying to do small projects to help me learn. When I try to run my program, the fahrenheit values print properly, but the celsius value prints as a series of numbers and letters. Here is my code
#include <iostream>
using namespace std;
double conversion( double& fahrenheit, double celsius)
{
celsius = (fahrenheit - 32.0) * (5.0/9.0);
return celsius;
}
int main()
{
double fahrenheit;
for ( fahrenheit = -40.0; fahrenheit <= 220.0;)
{
cout << fahrenheit << "F = " << conversion << "C" << endl;
fahrenheit = fahrenheit + 10.0;
}
system( "pause" );
return 0;
}
Aucun commentaire:
Enregistrer un commentaire