Welcome to the start of my C++ programming tutorial for beginners!
In the following weeks and months I will be publishing a step-by-step tutorial for programming beginners with the goal of teaching you the basics of programming in C++. At the end of this series of tutorials, you should be able to write your own programs from scratch, solving different problems with the help of your own software.
Before we start with the actual tutorial, the following steps are needed for preparation, independent of the operating system:
It might take some time to get these steps done, but if done properly you won't have to do it again unless you want to install the development tools on a different system. After that we can start with some real programming.
By the way, you can use the links in the list above to jump down to the detailed description for each step below.
As you might have noticed, this part of the tutorial starts with the number zero. For programmers this is the first natural number, whereas mathematicians normally use one as the first number.
This is due to the fact that our computers are based on binary logic where zero is the first usable value.
In mathematics, people were already counting things and doing calculations long before there was the need to represent "nothing" with a numerical value.
The fact that zero is used as the first (natural) number gets important when it comes to programming with index numbers etc. More on this later in this article series.
If you are reading this article with a web browser on your own PC or notebook computer, you can skip this step and continue with step 2 of the preparation phase.
However, if you are reading this article on a mobile plattform or on a computer that you don't have regular access to, the first thing to do is to get yourself a computer of your own. Alternatively you can talk to the person who owns the computer and get an arrangement for an additional user account and time to use for programming.
For this tutorial you only need a standard personal computer (PC). It does not have to be the latest model. It can be a PC running Windows (XP, Vista, Windows 7 or 8), Linux or a Mac with MacOS X.
This step is completely optional.
If you are using your own private PC for this tutorial and if there are no other people using it, you can use your standard user account.
However if you are not using your own computer or if your family computer does not yet have separate user accounts for all of its users, I recommend to set up an additional user account for programming and software development.
This makes it easier to separate the software development from other activities with your computer. If you set a password for the development user you can also avoid that your program code is changed by another user (accidentally or on purpose).
At the same time, this allows you to set up a separate desktop environment especially for programming, with links to tools etc. that you do not need outside of software development.
Alternatively, if you are already using virtual machines, you can also set up a new virtual machine especially for programming. Unless other people use the same virtual machine, you don't have to create additional user accounts on it.
As a last option, if you are using a software add-on for your operating system which allows you to create separate virtual desktops, you can use this to create a desktop environment for software development. Then, when you want to program, you can just switch over to the preconfigured development desktop.
After organizing the necessary programming hardware (PC, Mac, notebook computer) and (optionally) setting up your development user account the next thing we need is the basic software for programming.
If you are going to use a separate user account or virtual machine for programming, you should download and install the development software from this new user account or virtual machine.
In this tutorial I have chosen the C++ programming language. C++ development tools are available for all mayor operating systems. Additionally I have chosen to use the Qt libary with the corresponding development environment.
With this combination the programs in this tutorial should run on Macs with MacOS X as well as PCs with Windows or Linux, even when using advanced features of the operating systems, such as graphical frontend functions.
While a final, compiled program will not be able run on a machine with a different operating system, the same source code can be used to compile and build the same program on a different plattform.
First we need the basic compiler, linker and debugger with the additional C++ function libraries. Depending on the operating system which you are using there are different options for the current Qt Version 5. The supported platforms can be found on the Qt developer network website under the following link: https://doc.qt.io/qt-5/supported-platforms.html.
Following the currently supported and officially tested options, you can choose between the following according to your computers operating system (click on the relevant entry for your system in order to jump to the according part of this article):
On the following pages you can find the links and information for downloading and installing the C++ development tools and the additional Qt library and development environment for each of the different operating systems. You can follow the page links or jump ahead to your operating system of choice by using one of the following links: