BaseCodeByte

Chapter 016 total

Hello, World

Every C++ program starts with a main() function. Inside it, you write instructions. The program runs those instructions from top to bottom. std::cout lets you print text to the screen, and std::endl moves to a new line.

  • 01#include <iostream> tells the compiler to include the input/output library.
  • 02std::cout << "text" prints text. The << operator sends data to cout.
  • 03return 0; at the end of main() signals that the program finished successfully.
In [1]main.cpp

Challenge

Print your own name on a third line using std::cout. Add a line that says 'My name is ...'.