C++ is an extension of the C language created by Bjarne Stroustrup in 1979. It adds Object-Oriented Programming (OOP), templates, exceptions, and the Standard Template Library (STL) while preserving direct hardware performance.
Unreal Engine, AAA games, DirectX, and OpenGL are built in C++ for maximum frame rate and millisecond-level responsiveness.
Instant access to highly optimized algorithms (sorting, searching) and data structures (vectors, hash maps, queues, heaps).
RAII (Resource Acquisition Is Initialization) and Smart Pointers prevent memory leaks automatically without garbage collection.
C++ uses streams (std::cout and std::cin) via the <iostream> header.
1#include <iostream>
2#include <string>
3
4int main() {
5 std::string name;
6 std::cout << "Enter your name: ";
7 std::cin >> name;
8
9 std::cout << "Hello, " << name << "! Welcome to Modern C++.\n";
10 return 0;
11}1# Compile with C++20 standard and optimizations
2g++ -std=c++20 -O2 main.cpp -o app
3
4# Run binary
5./app