C++ ยท Chapter 1 of 49

C++ Introduction

C++ is a high-performance, compiled programming language created by Bjarne Stroustrup in 1985 as an extension of C. It adds object-oriented, generic and low-level memory features, which makes it a favourite for competitive programming, game engines and operating systems.

Because C++ compiles straight to machine code and gives you fine control over memory, programs run extremely fast. It is the backbone of tools like Chrome, Windows, most game engines, and is the language of choice in competitive programming contests like Codeforces and ICPC.

Why learn C++?

C++ teaches you how computers actually work โ€” memory, pointers, and performance trade-offs. It is required for systems programming, embedded devices, and is dominant in competitive programming due to its speed and rich standard library.

Where is C++ used?

Operating systems, browsers, game engines (Unreal Engine), databases, high-frequency trading systems, and virtually every competitive programming judge supports it as a first-class language.

Example 1 (cpp)
#include <iostream>
int main() {
    std::cout << "Hello, World!";
    return 0;
}
Output
Hello, World!

iostream provides std::cout for printing text to the console.

Example 2 (cpp)
#include <iostream>
using namespace std;
int main() {
    cout << "C++ is fast!";
}
Output
C++ is fast!

`using namespace std;` lets you drop the std:: prefix.

Key points

  • C++ is a compiled, statically typed language.
  • Created by Bjarne Stroustrup as an extension of C.
  • Used in systems software, games and competitive programming.
  • Gives direct control over memory via pointers.
๐Ÿ’ก Note: C++ standards evolve (C++11, 14, 17, 20, 23) โ€” modern C++ code looks quite different from old-style C++98 code.

๐Ÿ“ Quick Quiz

1. Who created C++?

2. C++ programs are:

3. Which header provides cout?