C++ practise code