My code in Cpp