Programming Tutorial (C++)
Introduction to computer programming
What is computer programming?
Short answer: programming is writing computer programs. But then, is the ability to write morse code called "coding"? I don't think so.
So what is the computer programming language? Computer programming is generally a vague term, but in the essence, it can indeed be shortened out to "writing computer programs". This book will teach you the basics of computer programming, primarily focusing on the C++ programming language.
What is C++?
C++ is a programming language with a rich history. It is quite a complex language, I would say one of the largest ones there exists. C++ is a compiled language, meaning, it takes source code as input, and produces an executable image as output. Source files are called Translation Units, or TUs for short. Multiple TUs composed together are called a program.
C++ is a language, consisting of standards and implementations. The first C++ standard was C++98 (codename: ISO/IEC 14882:1998, and the final working draft was N1804.
In 2025, the latest released C++ standard is C++23, with C++26 being in development. We will be using C++23 in this book.
Hello World in C++
What is Hello World? Most people know it as "the first program". It is true, but it has a history background attached. The phrase comes from Programming in C: A Tutorial internal memorandum, it was used as an example program (1974).
#include <print>
int main()
{
std::println("Hello World");
return 0;
}
What does the code above do? It prints "Hello World".
Basics
C++ source code consists of tokens. These tokens include keywords, identifiers, literals, operators and more.
Each C++ program has to define an entry point. C++ defines the default entry point to be the main function.
Functions, are procedures containing code. They have to have a return type, a name and a parameter list. Syntax of a function signature is as follows:
return-type name(parameter-type parameter-name)The parameter name is optional. A function contains a declaration and a definition. In short, when the declaration has a body, it is called a definition.
// declaration
int main();
// definition
int main() { return 0; }