Why is one not "supposed" to use #include <iostream.h> or #include <whatever.h>? What benefit does #include <iostream> using namespace std have?
Why is one not "supposed" to use #include <iostream.h> or #include <whatever.h>? What benefit does #include <iostream> using namespace std have?
the #includes with the .h extension are the old C headers, the <iostream> is the new C++ headers.
My Avatar says: "Stay in School"
Rocco is the Boy!
"SHUT YOUR LIPS..."
so
<iostream>
<conio>
using namespace std;
is the same as using the include directives for the same files, doesnt the names space setup an area to do with variables or something.
Monday - what a way to spend a seventh of your life
Including a header file like iostream.h has the same effect -- it imports all the variables/functions in the header file to the program's global namespace.Originally posted by iain
so
<iostream>
<conio>
using namespace std;
is the same as using the include directives for the same files, doesnt the names space setup an area to do with variables or something.
My understanding is that the .h has been removed from the STD headers only (standard C++ Library). I'm not sure if <conio> is included since it is DOS specific I believe. Use <conio.h> just in case.
using namespace std;
is the same as ...
std::cout >> something here;
USING the namespace eliminates the need to write the prefix std::
you could use the functions in the C++ headers without defining a namespace but you would have to put in that prefix for each std function, stream, what have you.
My Avatar says: "Stay in School"
Rocco is the Boy!
"SHUT YOUR LIPS..."