Lesson 1

Your First C++ Program

In this first lesson, you will write and run a simple C++ program in Visual Studio 2026 and understand the role of main(), #include, and cout.

Hello World Example

A classic beginner program displays a short message on the screen.

Example
#include <iostream>
using namespace std;

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

How It Works

Try it yourself:

Change the message to display your own name and a greeting, then run the program again.

Book Tip:

This short lesson is part of a larger learning path. The full book expands each topic with more explanation, exercises, and projects.