Solution to Simpletron exercises in C++