FoxGaming
Exalted Member
I have been assigned to make a program to convert Fahrenheit to Celsius, I'm programming everything in RedHat with g++ as my compiler. Everything functions proper except when I run my program against the testBed. When the user enters in 0 for Fahrenheit the testBed says i should be getting -18 degrees Celsius, however it is rounding down and i'm getting -17. Currently my program is passing 4/5 of the testBed tests, which is still a B. I'd still like to figure this out though.
I can provide a windows solution if anyone would rather have it, though there is really no difference.
I can provide a windows solution if anyone would rather have it, though there is really no difference.
Code:
#include <iostream>
#include <iomanip>
using namespace std;
/**********************************************************************
* Add text here to describe what the function "main" does. Also don't forget
* to fill this out with meaningful text or YOU WILL LOSE POINTS.
***********************************************************************/
int main()
{
cout.setf(ios::fixed);
cout.precision(0);
cout << "Please enter Fahrenheit degrees: ";
int Far;
cin >> Far;
int C = 5.0 / 9 * (Far - 32);
cout << "Celsius: " << C
<< endl;
return 0;
}