I forgot to mention that this has to be done in C++