All lessonsOpen Open Open Open Open
1. Getting started
Hello World
0 of 5 activities0%
Reading 1
A C++ program has a starting point
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?
What does cout << "Hi"; do?
Fill in 3
The entry point
Try it 4
Run Hello World
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
Print exactly Hello, SD Hub! followed by a newline. Do not add extra spaces.
main.cpp
Loading editor…