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.
#include <iostream>gives access to input and output tools.using namespace std;allows us to use standard library names directly.int main()is the starting point of the program.coutdisplays output to the console.return 0;ends the program successfully.
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.