My code in C ++.