The C++ formatted output using the console output, cout<< 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 console output, cout<< to print some text in C++ programming

To show: How to use console output, cout<< to print some text in C++ programming

 

#include <iostream>

using namespace std;

 

void main(void)

{

cout<<"Welcome to C++ standard formatted I/O module!!!"<<endl;

cout<<"Welcome to ";

 

// endl is end line stream manipulator issue a new line character and flushes the output buffer.

// Output buffer may be flushed by cout<<flush; statement

cout<<"C++ formatted input/output..."<<endl;

}

 

Output example:

 

Welcome to C++ standard formatted I/O module!!!

Welcome to C++ formatted input/output...

Press any key to continue . . .

 

 

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