bugl
bugl
HomeLearnPatternsPathsSearch
HomeLearnPatternsPathsSearch

Loading lesson path

Learn/C++/C++ Tutorial
C++•C++ Tutorial

C++ Output (Print Text)

Flash cards

Review the key moves

1/4
Core idea

What is the main idea behind C++ Output (Print Text)?

Lesson checks

Practice each idea before moving on

Short Mimo-style checks built from this lesson's code, terms, and sequence.

1Quick choice

Which statement best captures the main point of this lesson?

2Fill blank

Complete the missing token from the example code.

#___ <iostream>
3Order

Put the learning moves in the order that makes the concept easiest to apply.

Just remember to surround the text with double quotes ( "" ):
The cout object, together with the << operator, is used to output values and print text.
C++ Output (Print Text)

The cout object, together with the << operator, is used to output values and print text.

Just remember to surround the text with double quotes ( "" ):

Example

#include <iostream>
using namespace std;
int main() {
  cout
  << "Hello World!";
  return 0;
}

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:

Example

#include <iostream>
using namespace std;
int main() {
  cout
  << "Hello World!";
  cout
  << "I am learning C++";
  return 0;
}

Tip

You will learn how to add new lines in the C++ New Lines chapter .

Previous

C++ Statements

Next

C++ Output Numbers