Code for the KTH course in c++