Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

C++ Example - Output Newline

C++ Example - Output Newline

C++ Example C++ Example

Use C++ to output and break lines between multiple outputs, using \n or endl:

Example - \n newline

include

<

iostream

using

namespace

std

;

int

main

(

)

{

cout

<<

"

Runoob

\n

"

;

cout

<<

"

Google

\n

"

;

cout

<<

"

Taobao

"

;

return

0

;

}

Example - endl newline

include

<

iostream

using

namespace

std

;

int

main

(

)

{

cout

<<

"

Runoob

"

<<

endl

;

cout

<<

"

Google

"

<<

endl

;

cout

<<

"

Taobao

"

;

return

0

;

}

The output of the above program is:



Runoob 

Google 

Taobao

C++ Example C++ Example