C++ Output (Print Text)

In C++, you can show text and values on the screen using the cout object and the << (insertion operator). This is essential for communicating with users and displaying information in programs.

Tutorials dojo strip



Basic Output Example

When printing text in C++, always enclose the content within double quotes (" "):

C++




Multiple Output Statements

You can include multiple cout statements in a program. However, they do not automatically create new lines:

C++

Explanation:

  • First statement: Prints "Revving up the engine!"
  • Second statement: Immediately prints " Time to hit the road!" on the same line.
  • Since there is no automatic line break, the output appears next to each other without separation.
Tutorials dojo strip