← C++ tutorial

C++

Introduction to C++

C++ compiles down to machine code and gives you fine control over memory and performance — it's used for games, operating systems, and other performance-critical software where every millisecond and every byte genuinely matters.

Example: a minimal C++ program

#include <iostream>
using namespace std;

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

#include <iostream> pulls in the input/output library so cout (console output) is available. << "sends" a value to cout to be printed, and return 0; tells the operating system the program finished successfully — a nonzero return would signal an error occurred, a convention this language shares with C and most command-line tools.

Example
#include <iostream>
using namespace std;

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