Welcome & Hello World
C++ is a high-performance, general-purpose programming language developed by Bjarne Stroustrup in 1979 at Bell Labs as an extension of the C language ("C with Classes"). In this first lesson, we will cover the core structure of a C++ program and look at compilation pipelines.
1 Compiling in C++
Like C, C++ is a fully compiled language. It compiles directly into raw processor binaries using compilers like `g++`. In modern C++ (C++11, C++17, C++20), compiler optimization passes are highly sophisticated, resulting in performance that forms the engine backend of modern game frameworks, graphics engines, and real-time systems.
2 Hello World Syntax Analyzed
Let's run a classic Hello World program in C++:
C++ — Hello World
▶ Run Code
#include <iostream>
int main() {
std::cout << "Hello, World!" << std::endl;
std::cout << "Welcome to Our C++ Compiler!" << std::endl;
return 0;
}
Let's break down the keywords:
- #include <iostream>: Preprocessor directive that includes standard Input-Output stream headers, housing output utilities like `std::cout`.
- std::cout: Standard character output stream that directs text outputs to the console.
- <<: Insertion operator that pushes text or parameters to the output stream.
- std::endl: Closes the stream sequence and inserts a newline character, flushing the stream buffer.
- return 0: Returns a success state integer to the host operating system.
3 Code Challenge
Challenge: Edit the code in the editor above. Add a statement using `std::cout` that outputs a tab (`\t`) and then prints your name. Compile and run it.