0
Whats wrong with this code?
#include <iostream> using namespace std; int main() { int c,f; cout<<" Type in a temperature in °F: "<<endl<<endl; cin>>f>>endl; c=5/9*(f-32); cout<<f<<"°F="<<c<<"°C"<<endl; return 0; }
3 Answers
+ 2
Three things.
1.) No 'endl' in the line with 'cin';
2.) the ints should be doubles,
so that you get precise results;
3.) most tricky: 5/9 -> 0, because
both are integers. Write either
5.0/9 or 5/9.0 instead!
+ 1
Thank you guys, now everything works properly :)
0
Does it throw an error? I would change c from int to double tho and I will not use endl incon althou I do not know if that is something you can call wrong