All lessons

1. Getting started

Hello World

0 of 5 activities0%

Reading 1

A C++ program has a starting point

Open

C++ is a compiled language: you write source code, a compiler turns it into a program, and then the program runs.

Every C++ program starts in a function named main. The smallest useful program prints text using std::cout from the iostream library.

The line using namespace std; lets you write cout instead of std::cout. We will use it in these lessons to keep examples short.

#include <iostream>
using namespace std;

int main() {
    cout << "Hello, World!" << endl;
    return 0;
}

Check 2

Where does output go?

Open

What does cout << "Hi"; do?

Fill in 3

The entry point

Open

A C++ program starts running in a function named

Hint: It is a four-letter English word.

Try it 4

Run Hello World

Open

Hit Run. Then change the message inside the quotes and run again.

main.cpp
Loading editor…
Output will appear here.

Assignment 5

Print a specific greeting

Open

Print exactly Hello, SD Hub! followed by a newline. Do not add extra spaces.

main.cpp
Loading editor…