Formatted code, added STL use and others

Basically, I ran the code through a formatter, improved readability and used STL algorithms. There was also a problem you had in your MenuInstr.cpp file: To my knowledge you were attempting to replace each "\n" in the file with the newline character. You won't be able to do that without writing the new contents to a different file and renaming it to that target file. That's also what I added.