License : Creative Commons Attribution 4.0 International (CC BY-NC-SA 4.0)
Copyright :
Frédéric Pennerath,
Hervé Frezza-Buet,
CentraleSupelec
Last modified : April 19, 2024 10:22
Link to the source : index.md
This page gathers C++ teaching materials, developped at CentraleSupélec. It is made of a table of contents, where links to different kind of topics can be reached.
Fill free to explore the topics in the order you want, even if they are organized here so that you can enter C++ progressively.
The C++ we are teaching here is standard, but the materials have been tested with the gnu compiler g++
, using linux. Windows and MacOS users have to make a c++ compiler available on their workstation on their own.
Intalling g++
on Ubuntu is straightforward
mylogin@mymachine:~$ sudo apt install g++
Even if many SDK exist to handle the compiling of big projects, it can be nice, during learning, to invoke directly the compiler for every single compiling, apart for any automatic process. It is thus a good idea to be familiar with bash-like command interpretors.
For example, you can check that you are able to run the following command on a terminal in order to get your compiler version (this works for the gnu compiler).
mylogin@mymachine:~$ g++ -v
You can use emacs, vim, geany, vscode… or any kind of editor that highlights C++ code. For using command lines, you need a nice console, i.e. a terminal that understand colors and UTF-8.
Default terminal on linux does the job. For editing, vscode can be a good start if you are not already familiar with a good editor.
First, take the time to follow precisely the C++ self-study. It teaches you the basics of C++, stressing how memory is handles and how C++ code looks like.
Before entering into more advenced programming, you need to understand what C++ compiling actually is.
In C++, everything is quite explicitly about storing value in the RAM and retreiving values from the RAM. To memory issues need to be clearly understand before entering the design of smart programs.
Since C++-11, types are of major importance. This makes C++ very close to the binary code while still expressing computational concepts, that can be checked at compiling time. Some syntactic sugar comes with this, enabling the programmer to implement formally guided program design into an efficient language, directly linked to the execution on the processor.
The execution thread is mainly controlled by function calls. Of course, conditional and loop statement locally enable to control the execution, but in the big picture, the execution of a program is an articulation of intricated function calls.
You can practice in order to get used to the environement for passing the C++ test. To do so, on Linux, get this archive and put it in some directory. The following command have to be called from that directory.
mylogin@mymachine:~$ tar zxvf exam-subject.tar.gz
mylogin@mymachine:~$ cd exam-subject
You are now placed in real C++ test conditions. Type the following
mylogin@mymachine:~$ make instructions
And pass this very easy test.
Here, you will find exercises from past exams. Use them for training.