C++ Code for Study