0
Why is my code not compiling?
#include <iostream> using namespace std; float cels_fahr (float tc) { float tf; tf = 1.8 * tc + 32; return tf; } int main() { float cels; float fahr; cout << "Type temperature in Celsius:" << endl; cin << cels; fahr = cels_fahr (cels); cout << "Temperature in fahrenheit: " << fahr << endl; return 0; }
4 Answers
+ 1
ohh. i see your problem. right after cout<<"type temperature......", there's a cin statement like this
cin<<cels, it should be cin>>cels;
+ 1
OMG! Such a stupid mistake! haha
Working now.
Thanks a lot! :D
0
I tried that and it still won't compile.
- 3
include a prototype before main, i.e
float cels_fahr(float);



