Concatenating using the << operator C++ program example

 

Compiler: Visual C++ Express Edition 2005

Compiled on Platform: Windows XP Pro SP2

Header file: Standard

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: Concatenating using the << operator in C++ programming

To show: How to concatenate using the << operator in C++ programming

 

// concatenate using << operator

#include <iostream>

 

int main(void)

{

std::cout<<"47 plus 54 is "<<(47 + 54)<<"\n";

std::cout<<"Welcome to C++ stream\n";

 

return 0;

}

 

Output example:

 

47 plus 54 is 101

Welcome to C++ stream

Press any key to continue . . .

 

 

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