Utilizor
Contact Us

C++ Output

Displaying output in C++.

C++ Output (Print Text)

The cout object, together with the insertion operator (<<), is used to output values/print text.

You can add as many cout objects as you want. However, note that it does not insert a new line at the end of the output automatically.

New Lines with \n

To insert a new line, you can use the \n character (backslash n). This is the preferred method for performance in many cases.

New Lines with endl

Another way to insert a new line is with the endl manipulator. This not only inserts a newline but also flushes the output buffer.

Both \n and endl are commonly used.