C and C++ practise code