Skip to main content

📝 Lesson 0: Introduction to C++

Take your first step into C++ programming — discover what programming really is, why C++ still matters, and write your very first working program.

🎯 Learning Objectives

By the end of this lesson, you will be able to:

  • Explain what programming is and how a program instructs a computer.
  • Describe why C++ is used for games, systems, and performance-critical software.
  • Read and understand the structure of a simple "Hello, World!" C++ program.
  • Identify the key parts of a C++ program: headers, main(), and statements.

Estimated Time: 15–20 minutes

Project: Write and run your very first C++ program that prints a greeting to the console.

In This Lesson

What is Programming?

Programming is the art of giving computers precise instructions to solve problems. Think of it as writing a recipe for a robot.

graph LR A[Human Thinks] --> B[Write Instructions] B --> C[Computer Reads] C --> D[Computer Executes] D --> E[Result Produced]

Why C++?

C++ is powerful, fast, and versatile — used in gaming, systems, and performance-critical applications.

First C++ Program

The classic "Hello, World!" program demonstrates the basic structure of C++ code.

#include <iostream>
using namespace std;

int main() {
    cout << "Hello, World!" << '\n';
    return 0;
}

🎯 Quick Quiz

Question 1: In the "Hello, World!" program, what does the line using namespace std; do?

Question 2: What does the statement cout << "Hello, World!" << '\n'; do?

Question 3: Which of these is a key reason C++ is widely used for game engines and other performance-critical systems?

Summary

🎉 Key Takeaways

  • Programming means giving a computer precise, step-by-step instructions to solve a problem.
  • C++ is fast, powerful, and widely used in games, operating systems, and other performance-critical software.
  • Every C++ program needs a main() function — that's where execution begins.
  • #include <iostream> brings in the tools needed for console input and output.
  • cout << ...; sends output to the screen; using namespace std; saves you from typing std:: everywhere.
  • return 0; tells the operating system your program finished successfully.

📚 Additional Resources

🚀 What's Next?

You've written and understood your first C++ program — now it's time to get your machine ready to build many more. In Lesson 1: C++ Development Environment Setup, you'll install a compiler, set up an editor or IDE, and learn how to compile and run the C++ code you just saw firsthand.

🎉 You've written your first line of C++!

Every professional C++ developer started exactly where you are right now. Keep going — the next lesson gets your toolkit ready for everything ahead.