Short C++ excercise (for beginners)