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

C++ Example - Standard I/O

C++ Example - Standard I/O

C++ Example C++ Example

Use C++ to get user input and output it to the screen:

Example

include

<

iostream

using

namespace

std

;

int

main

(

)

{

int

number

;

cout

<<

"

Enter an integer:

"

;

cin

number

;

cout

<<

"

The number entered is:

"

<<

number

;

return

0

;

}

The output of the above program is:



输入一个整数: 12

输入的数字为: 12

C++ Example C++ Example