0

Cin.ignore(1,'\n');

i understand the code but im not sure what "cin.ignore" is ignoring, i tried putting in a "0", but then author and title would print on the same line, very minor question but i cant figure it out, is it ignoring "i++" or "b[i]". Thanks https://code.sololearn.com/cuykNnpGtsv2/?ref=app

19th Oct 2017, 9:12 AM
Gryn T
Gryn T - avatar
1 Answer
+ 2
The cin.ignore() method is used to ignore the last n characters from the input buffer used to store the characters read from the console. By default, it ignores the last '\n' present in the buffer. But it accepts two arguments : cin.ignore(n, ch); ch - The character to be ignored. After this is found, ignoring stops. n - The number of characters to ignore(Not just ch, will ignore all characters present in the stream). Will stop after the limit is exhausted (n chars ignored) or the terminating character ch is found before n characters could be ignored.
21st Oct 2017, 8:27 AM
Solo Wanderer 4315
Solo Wanderer 4315 - avatar