C++ program compilation for some string based problems