📅  最后修改于: 2022-03-11 14:44:48.516000             🧑  作者: Mango
// 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);