Course 1 – Introduction


The computer contains a lot of hardware pieces, such as the CPU (Central Processing Unit), the HDD (Hard-disk), RAM (Random Access Memory) and so on – each of them having their own functionality.

Hard Disk Drive (HDD)

HDD is the persistent memory (long term) – everything we have on the computer (files, applications) can be found there – the data remains stored on the disk even if we close the computer.

To make an analogy with the real world, we can imagine the HDD like a room in an apartment. Let’s say we have an apartment with 2 rooms, 50 mp2 (storage room – like the HDD size). We buy some furniture and place it on the room, and it stays there even after we leave the room. (Furniture = our files).

Random Access Memory (RAM)

RAM is the volatile memory (short term) – it stores the data for the applications that are currently running on the computer. Let’s take the browser, for example: We start it, and a new process is created by the operating system. It then receives a piece of this RAM to use to load itself in memory, and store information such as the data we see on the screen when we browse the web.

As an analogy, we can see it as the hallway in our apartment. When we want to do some exercises, we take the dumbbells, take them on the hallway, and start exercising. When we’re done, we take them from there and move them back to the storage closet.

Central Processing Unit (CPU)

The CPU is the one that is doing all the work – it’s the brain of the computer.

He can perform 3 operations:

  • Fetch: Read an instruction from RAM
  • Decode: Decode instruction
  • Execute: Execute the instruction (arithmetic, data comparison, moving data in memory)

CPU can only understand 0s and 1s. What are those things more specifically?

Well, that’s binary.

Inside the computer, there are cables and circuits that transport data – using electricity to do so.

If we have only one circuit through which the electricity is moving, the signal can be either on or off. Based on this, we can represent the value of 0 (closed – electricity is not moving through it), and 1 (open, electricity is moving through it).


We speak about the CPU and how it understands only 0 and 1 – but we’re writing the software side – and we don’t use 0s and 1s.

When we write code, we use text – language specific words. That text need to be transformed in 0 and 1 for the CPU to understand it.

Compiled and Interpreted languages

Interpreted languages need a tool (interpreter) to execute the text, line by line – more specifically, it transforms it in 0 and 1, and sends the instruction to be further processed.

Compiled languages are using a compiler to transform the text in 0 and 1, before the application is run. After the code is there, you run the compiler, and it creates an executable (process/binary) – a file that can be run on the CPU.

Long story short – the code needs to be transformed in 0 and 1 – the difference between these two is the moment that is done – one is performed before being executed (compiled), and the other in real time (interpreted)

About C++

C++ is a compiled language.

This means we write the code in english (natural language), and the compiler generates binary code (0, 1) in a separate file, which can be executed / understood by the CPU.

When we double-click the executable to open it, a process is created (by the operating system) and the information is stored in RAM, so that the CPU can access it (to read and execute).

C++ contains a set of instructions and keywords specific to the language.

Other than that, we have access to a library called the STL (standard library) – functionality that we can use, already created by the people that work to develop the language.

Data types in C++

Let’s talk about some data types.


When we want to use a number for example, we need to tell the compiler that. We give it a number, and a value.

Let’s say we want to have a variable called number, of type integer, with a value of 5.

Notice the ; at the end of the instruction. Without it, we will receive errors.


The boolean type (bool) is a data type that can only have 2 values, true or false.


char (character) is a data type that can store the value of one digit, letter, etc.


string is part of stl, but we’ll get to that later. It’s a set of characters, and we can use it to represent a word, a text, and so on.

Let’s assume we want to have a variable that can store our name and another one to store our age. The name can be a string, whereas the age should be an int.

You may also like...