Learn
Hello World
Output

High five! We just got your first program to run.

C++, like most programming languages, runs line by line, from top to bottom. Here is the structure of a C++ program:

Program Structure

In between the curly braces is what we are going to focus on for now.

std::cout << "Hello World!\n";
  • std::cout is the “character output stream”. It is pronounced “see-out”.
  • << is an operator that comes right after it.
  • "Hello World!\n" is what’s being outputted here. You need double quotes around text. The \n is a special character that indicates a new line.
  • ; is a punctuation that tells the computer that you are at the end of a statement. It is similar to a period in a sentence.

Instructions

1.

Let’s write the whole std::cout statement from scratch.

Inside the curly braces, type the following and press Run:

std::cout << "Codecademy\n";

What do you think this program will output?

Folder Icon

Take this course for free

Already have an account?