stuck at basics!!!!!!

I just started C++ two days ago. I am having a slight problem. When I give the input- 97 Fahrenheit, I get the output as 36 Celsius instead of 36.11, having declared TempC as float type.

#include <iostream>
using namespace std;

main()
{
int TempF;
float TempC;
cout <<"Enter the Temperature in Fahrenheit: ";
cin >> TempF;
TempC = (TempF-32)*5/9;
cout <<"The Temperature on Celcius scale is "<< TempC << endl;
system("pause");
}
Last edited on
Make TempF a float.
it can be either a float or a double. int is a straight integer, and will only be displayed as a integer and the .011 will not be a part, whereas with a float or double the decimal part is included.
I loled @ Farnehite.
lol, i always had problem with english.
Don't think "Fahrenheit" counts as english.
Topic archived. No new replies allowed.