Tech
C++ Input Doesn't Have to Be Complicated: Word vs. Line Input with EasyIn
If you're learning C++, one surprisingly common source of confusion is input.
Why does this:
std :: cin >> text ;
only read one word?
Why does std::getline() sometimes seem to skip an input?
And why does reading text from a file suddenly print every word on a separate line?
The answer becomes much simpler once you understand that C++ has two different ideas here:
reading a value and reading a line .
That's also the idea behind my small head...
Read the full discussion on Dev.to
This article was aggregated from Dev.to. Click to join the conversation.
View on Dev.to