Short C++ excercise