-
Compilation problems?
I am new to programming and recently downloaded bloodshed devc++ (4.9.8.0). After testing to make sure it worked like I hoped, I copy and pasted this code from one of the tutorials on this website and compiled it:
Code:
#include <iostream.h>
int main()
{
int thisisanumber;
cout<<"Please enter a number:";
cin>>thisisanumber;
cout<<"You entered: "<<thisisanumber;
return 0;
}
However, this gave errors such as <In file included from C:/DEV-CPP/include/c++/backward/iostream.h> and <#warning This file includes at least one deprecated or antiquated header.>
Then after searching for a solution from other posts I got it to work by changing the code to
Code:
#include <iostream>
using namespace std;
int main()
{
int thisisanumber;
cout<<"Please enter a number:";
cin>>thisisanumber;
cout<<"You entered: "<<thisisanumber;
return 0;
}
This goes against everything I have learned thus far and was wondering why this works the way it does.
-
The tutorials on this site (and many others) are outdated. Your compiler is not outdated, it is up to date. You changed your code from using the old, non-standard header file <iostream.h>, to use the new, standard header file <iostream>.
I think they are in the process of updating the tutorials, but until then, you will have to remember to use new headers instead of old ones. See the following page for more information:
http://www.cplusplus.com/doc/ansi/hfiles.html