C++ code that I tried out - learning