Syntax

C++ Print to Console Syntax

In C++, print to console: prints to standard output — std::cout << "Hello" << std::endl;

Quick Answer

Syntax
std::cout << "Hello" << std::endl;
C++Syntax

Print to Console

Code example
std::cout << "Hello" << std::endl;

Prints to standard output.

Learn More

How to print to console in C++

  1. Open your C++ file or editor.
  2. Copy the example, then replace its sample names and values for your code.

C++ Print to Console Syntax

Use std::cout << "Hello" << std::endl;.

Related Syntax References

Frequently asked questions

What is the C++ syntax for print to console?

Use this pattern: std::cout << "Hello" << std::endl;

Can I copy this C++ code example?

Yes. Use Copy code and adapt the example to your program.

Is this C++ syntax different on Mac or Windows?

No. The language syntax is the same across operating systems.

Official source · How we verify