Laboratory C++.

Tuesdays 8-10, room 7
Thursdays 12-14, room 137

June 27th

Lab will be from 13.15 to 15.15 in room 137. Try to end your tasks by this day.

End of Teaching Period

The teaching period has ended. I will continue having labs on thursdays 12-14 in room 137, but not anymore on tuesday mornings, at least until end of June. Try to complete remaining tasks before then.

Aim of Laboratory

The laboratory has two goals which are somewhat in conflict with each other: I have to teach you, and I have to check/grade you. The balance between them depends on how much effort I believe you put in when you made the task.

It is better that you come at the beginning of the lab: If everyone comes at the end, I will not be able to check (and improve, see above) your programs. Therefore, come at the beginning. I give you a task for next week at the beginning, so that you don't have to waste your time while waiting. Another advantage of working/starting in the lab is that you can ask questions.

Tasks must be shown on a Linux computer. My experience is that in Windows, the integrated environments are not standard conforming, use most of the screen area for showing all the fancy options of the integrated environment itself instead of code, error messages and output. I am interested in your code and in its output.

If you bring your own laptop, try to read the screen from 1 meter distance under an angle of 45 degrees. If you cannot, you should use the computers in the lab.

Windows is designed for users who do not understand how a computer works. In order to cope with such users, it is designed in such a way that the user has no real control over the computer, since that only result in damage. The main decisions are taken by the programs, that have too much freedom to do what they like. As a consequence, you don't know where files are stored, what are the access rights, what programs are being installed, what programs are running and how much resources they are using, what data is being sent over the internet to whom, etc. Since for a professional this is a non-acceptable situation, we will use Linux from the beginning.

Useful Sites


  1. Exercise number 1 . Basics of Linux.
  2. Exercise number 2 . You need the following files: nr02.
  3. Exercise number 3 . Read this this explanation.
  4. More about the lifecycle operators. We are going to implement trees in C++, in order to show that there is no need for esoteric programming languages. Exercise number 4. You need the following files: nr04.
  5. Exercise 5 is a lot easier than 4. We use class tree of the previous exercise, to build a differentation program. Also, we will have a look at R-value references. (There will be a systematic treatment in a later exercise.)
  6. Exercise 6. The main containers in STL (vector and list). Correct use of iterators.
  7. Exercise 7 about map and unordered_map.
  8. It seems there will be no thursday lab. Tuesday will take place.
  9. Exercise 8 about inheritance.
  10. 30.04.2013. No Lab!
    02.05.2013. Also no lab.
  11. Exercise 9 about the 15-puzzle. This is additional code that you need for the task.
  12. Exercise 10 about templates.
  13. Exercise 11 about Conway's Game of Life .
  14. Exercise 12 about Rubik's Cube. You need assert.h , rubik.cpp , rotation.h , sequence.h , sequence.cpp , cube.h , and cube.cpp . This file contains explanation of the notation that I use for rotations of the cube. If you want to plot the state of a cube, you need switch on the #if-s in the code, and use the following makefile . It works in room 7, and will work on room 137. If you don't want to use graphics, use this makefile . This is the last task.