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.



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?

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?