// The reason getline is not getting user input is because // getline does not remove new lines from the buffer. // Before calling getline(), use cin.ignore() to clear the buffer std::cin.ignore(); getline(std::cin, str);