This code was implemented in C++ using Visual Studio 2010 IDE.