The C++ namespace: The namespace 'std' program example


Compiler: Visual C++ Express Edition 2005

Compiled on Platform: Windows XP Pro SP2

Header file: Standard

Additional library: none/default

Additional project setting: Set project to be compiled as C++

Project -> your_project_name Properties -> Configuration Properties -> C/C++ -> Advanced -> Compiled As: Compiled as C++ Code (/TP)

Other info: none

To do: Using the standard namespace in C++ programming, the fully qualified namespace

To show: How to use the fully qualified namespace in C++ programming




// namespace std example

#include <iostream>


void main(void)


// fully qualified name

std::cout<<"Demonstrating ";

// simplified name

using namespace std;

cout<<"the std namespace."<<endl;




Output example:


Demonstrating the std namespace.

Press any key to continue . . .



C and C++ Programming Resources | C & C++ Code Example Index