C++ excercise 3