Cin.ignore (numeric_limits <streamsize> :: max (), '\ n')
What does this particular line of cin.ignore(numeric_limits<streamsize>::max(), '\n') mean in C ++ programming? Does this actually ignore the last user login?
+14
Zyi
source share2 answers
This line ignores the rest of the current line, up to '\n' or EOF - whichever comes first:
'\n'sets the delimiter, that is, the character after whichcinstops ignoringnumeric_limits<streamsize>::max()sets the maximum number of characters to ignore. Since this is the upper limit of the stream size, you effectively tellcinthat there is no limit to the number of characters to ignore.
+15
dasblinkenlight
source sharecin.ignore (numeric_limits <streamsize> :: max (), '\ n');
Here, \n acts as a delimiter .... this is the point to which the code should be ignored (like "\ n" in this special case). And max() determines that there is no limit to how much you can ignore, spaces, tabs should be ignored until the end of the line.
0
Akash sharma
source share