No. That clear member function clears the error state of the I/O stream. In this case, the stream is still in a good state, so there's no point using that function. Rather, you want to ignore()...
Type: Posts; User: laserlight
No. That clear member function clears the error state of the I/O stream. In this case, the stream is still in a good state, so there's no point using that function. Rather, you want to ignore()...
Hint: the use of formatted I/O operator>> to read an integer leaves the newline from entering the integer text in the input buffer. getline will then read until that newline instead of the next line.