Yeah...exactly..new
ISO c++ standards suggest following way of including header files..
#include <iostream>thus the old style is deprecated..you can use it..but it means that support will be removed from future versions of g++.
now the second line...
using namespace std;is required because...keywords like..
cout,endl,cin are not in the current namespace...thus compiler will not recognise these keywords..unless you specify which namespace to use.
thus you can have two styles of coding...
CODE
#include <iostream>
using namespace std;
int main()
{
cout<<"Hello World"<<endl;
return 0;
}
or the other style could be like..this..
CODE
#include <iostream>
int main()
{
std::cout<<"Hello World"<<std::endl;
return 0;
}
or another style code could be..
CODE
#include <iostream>
using namespace std::cout;
using namespace std::cin;
using namespace std::endl;
int main()
{
cout<<"Hello World"<<endl;
return 0;
}
The idea behind this style is...you don't use the entire namespace..but only these three keywords..will belong to
stdnamespace.