Solution (1) is not recommended as it puts everything in the std namespace.
This can lead to name conflicts.
Solution (2) is better as it limits what is implicitly in the std namespace.
There is still a reduced risk of conflicts. For example, if someone were
to useendl in their own code it could be mistaken by the compiler for
std::endl in iostreams. (Or vice versa.)
Solution (3) is best as it specifies the namespace each time the
iostream members are used. There is no chance that a mismatch
will occur with like-named items.
The main() function must return an int, if it is to conform to the ANSI/ISO
C++ Language Standard. (And the C Standard.) Any other function may
be defined to return void, if desired.
- Wayne