WeCodeAcademy

C++ Introduction

C++ extends C with classes, templates and a rich standard library. It powers game engines, browsers, databases and anything that needs speed with good abstractions. C++ programs are compiled to machine code.

ExampleC++
#include <iostream>

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

#include <iostream> brings in input/output. std::cout is the output stream and << sends text to it. std::endl ends the line. To try an example yourself, save it as main.cpp, compile with g++ -std=c++17 main.cpp -o main and run ./main. The output under each example is the real output.

Quick check

Which object prints to the screen in C++?

Finish the quick check (and any code exercise) to complete this lesson, or mark it done yourself.

Tip: use the left and right arrow keys to move between lessons.