Creating C++ program question with near exact match output