Help me guys with this simple c++. I am a beginner and i need to check if this is functional because i haven't installed a compiler yet on my computer.
#include
in c++.,the code is like this.. save this (.cpp) #include<iostream.h> #include<conio.h> main() { int F,C; clrscr(); cout<<"Fahrenheit: "; cin>>F; C=(5/9)*(F-32); cout<<"Celsius: d%", &C; getch(); }
I thought the .h was unnecessary for modern C++ compilers.
must be using an older C++... you didn't have \[\small{\text{using namespace std}}\]in there.
Also, shouldn't the format specifier be %d instead of d%? Why would you have the address operator when you're interpolating the value of the variable C, and not it's address?
try using standard C++ functions and methods like cout, cin, and cin.get() instead of something from C like printf() and getch()
Join our real-time social learning platform and learn together with your friends!