Simple C++ code for simple tasks