need a good explanation

A

Anarki

what are the differences between

1) #include <iostream.h>

2) #include <iostream>
using namespace std;
 
M

Martin York

what are the differences between

1)  #include <iostream.h>
This was valid before the STL became standard.
After standardization it is no longer valid. Some compilers support it
but only for backwards computability, as a result any code using this
is not very portable.

2) #include <iostream>
    using namespace std;

This is part of the STL.
All items in the STL are in the std namespace.
 
J

Juha Nieminen

Anarki said:
what are the differences between

1) #include <iostream.h>

2) #include <iostream>
using namespace std;

Both are equally bad ways of saying:

#include <iostream>
 
K

kamit

As others have mentioned use #include <iostream> and NOT #include
<iostream.h>.

Case 1: #include <iostream>
Here everything is wrapped under the namespace std;


Case 2: #include <iostream.h>
Here everything is under global namespace.

HTH.
 
J

Jerry Coffin

The second is standard C++, the first is not.
None of the C++ standard headers contain ".h"
in their names.

....except the deprecated ones in part 5 of Appendix D.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top