getline cin is being skipped

Solutions on MaxInterview for getline cin is being skipped by the best coders in the world

showing results for - "getline cin is being skipped"
Luciano
18 Oct 2016
1// The reason getline is not getting user input is because
2// getline does not remove new lines from the buffer.
3// Before calling getline(), use cin.ignore() to clear the buffer
4
5std::cin.ignore();
6getline(std::cin, str);