Codeloft
0 0 XP

Hello, C++

7 min 20 XP + 10 for no hints

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
  1. Change the message to introduce yourself
  2. Print a second line with another std::cout
  3. Keep return 0; at the end of main

Quick check

What does every C++ statement end with?

main.cppChecked as you type
No problems found. Unclosed tags, missing semicolons and errors show up here in plain words.