C++ Tutorials

C++ Tutorials

New Style Header

  1. In C++ programs the header <iostream> is included. This header supports C++ style I/O operation ( <iostream> is to C++ what <stdio.h> is to C). Notice one other thing: there is no .h extension to the name iostream. The reason is the that <iostream> is one of the new style header defined by Standard C++. New-style headers do not use the .h extension.

Namespaces

The next line in the program is

  using namespace std;

This tells the compiler to use the std namespace. Namespace are a recent addition to C++. A namespace creates a declarative region in which various program elements can be placed. Namespaces help in the organization of large programs. The using statement informs the compiler that you want to use the std namespaces. This is the namespace in which the entire Standard C++ library is declared.

By using the std namespace you simplify access to the standard library. The C programs don’t need a namespace statement because the C library functions are also available in the default global namespace.