Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

getline cin is being skipped

// 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);
 
PREVIOUS NEXT
Tagged: #getline #cin #skipped
ADD COMMENT
Topic
Name
7+8 =