Hello,
I created a program to convert Celsius to Fahrenheit.
Code:
#include <iostream>
using namespace std;
float Fahrenheit, Celsius;
int main()
{
float Fahrenheit;
float Celsius;
cout<<"Enter the temperature in Fahrenheit: ";
cin>>Fahrenheit;
Celsius=(Fahrenheit-32)*5/9;
cout<<"The temperature in Celsius is: "<<Celsius;
cout << (int)Celsius << endl;
system ("pause");
return 0;
}
But it needs to round up or down. Meaning 55 F need to be 13 Celsius and not 12.7... I read now that I need to change it to int..which I did right here
Code:
cout<<"The temperature in Celsius is: "<<Celsius;
cout << (int)Celsius << endl;
system ("pause");
Also I need to do it by adding 0.5 to the calculation expression. Well that's it
Code:
Celsius=(Fahrenheit-32)*5/9;
but of course it wont work, if I do add + 0.5 to it. Can someone help me with this?