Learning C++ — Introduction the Language

Julien Hora
codeFromTokyo
Published in
3 min readNov 10, 2023

First things first: what is C++?

C++ is a high-level programming language developed by Bjarne Stroustrup as an extension of the C language.

It is known for its performance and efficiency, which makes it a popular choice for developing applications where performance is a critical issue, such as game development, real-time systems, and high-performance computing.

Why you should learn C++

Learning C++ can be a solid foundation for understanding more complex programming concepts and languages. It is often used to teach the fundamentals of data structures, algorithms, and object-oriented programming. C++ programmers are in high demand for their ability to write efficient and high-performing code.

Photo by Glen Carrie on Unsplash

I always see junior devs that start with languages like Python or JavaScript having a hard time at core concepts and I always recommend newcomers to start with C and C++. Although it has the reputation of being a “hard” language to learn, I believe that what you go through to learn C++ and understand it will help you understand most of the modern programming concept and even appreciate more when you’ll be faced with simplification of these concept offered by a language like Python.

The basic structure of a C++ program

A simple C++ program includes a main function where the execution of the program begins. It may also include comments, which are non-executable statements used to describe the code, and preprocessor directives, which are instructions to the compiler.

// Directive to include the input and output stream library.
#include <iostream>

// Main function - this is where the execution of the program happens.
int main() {

// Output "Hellow, World!" to the console.
std::cout << "Hello, World!";

// The exit status of the program, 0 means no error.
return 0;
}

How to get your environment ready for C++?

Before you can start programming in C++, you need to set up a development environment.

Installing a C++ compiler

The most common compilers are GCC for Linux, MSVC for Windows, and Clang for macOS.

Most operating systems are shipped with a C++ compiler. Make sure it is the case by typing g++ or gcc in the console. If it returns a message error saying the command wasn’t recognized, then you need to setup a compiler.

For Windows (through Visual Studio): https://visualstudio.microsoft.com/vs/features/cplusplus/

For macOS (through Xcode): https://developer.apple.com/xcode/resources/

For Ubuntu:

sudo apt update
sudo apt install g++

Choosing an Integrated Development Environment (IDE) or a code editor

Popular choices include Visual Studio, Visual Studio Code, or specialized tools like the ones from JetBrains.

Later on, we will be able to compile our code through the command line. We’ll dig into that later on in the series.

In conclusion

This article has introduced you to the world of C++ programming. You’ve learned about the significance of C++, the basic structure of a program, and how to set up your development environment.

As we continue this series, we’ll delve deeper into the language, and you will be able to start writing your own C++ programs.

Photo by sydney Rae on Unsplash

Until the next chapter, I strongly suggest you try to install a C++ compiler, get yourself an IDE you are comfy with, and try writing a program that prints something like your name or the classic “Hello World” to the console.

--

--

Julien Hora
codeFromTokyo

Founder @ Dreamrunner Labs | Senior Software Engineer | Unreal Engine Generalist