Speech Recognition: Theory and C++ Implementation