Hello, C++
Every C++ program starts running in a function called main. The line #include <iostream> brings in the tools for input and output.
std::cout << sends text to the screen. std::endl ends the line. Every statement ends with a semicolon.
C++ is compiled before it runs. Here, the checks read your code's structure as you type, and the Step through tab shows the example running line by line.
Example
#include <iostream>
int main() {
std::cout << "Hi!" << std::endl;
std::cout << "2 + 3 = " << 2 + 3 << std::endl;
return 0;
}
Output
Hi! 2 + 3 = 5
Missing semicolons cause most first C++ errors. The Problems tab flags likely ones.
Your tasks
1 of 3 done- Change the message to introduce yourself
- Print a second line with another std::cout
- Keep return 0; at the end of main
Tutor
The tutor guides you toward the answer instead of handing it over. It uses your own Claude usage.
Quick check
What does every C++ statement end with?
No problems found. Unclosed tags, missing semicolons and errors show up here in plain words.
1#include <iostream>
2
3int main() {
4 std::cout << "Hello, world!" << std::endl;
5 return 0;
6}
The program starts at main(). Everything inside its braces runs from top to bottom.
Variables
| No variables yet |
Output
Step 1 of 3