+ 2
Why we use cin.ignore() ? Can anyone tell me about this?
I wanna know about this because someone ask me about this but i don't know the reason behind this
6 Réponses
+ 3
cin.ignore() basically discards n number of characters or until the delimiting character has been found.
For example the statement "cin.ignore(10, 'J');" will ignore the first 10 characters (specified by the first parameter) or until the character "J" is found (specified by the second parameter). Both of these parameters are optional and will default to 1 (first parameter) and EOF (second parameter).
+ 3
So, we use ignore function to ignore the chars until user enter a specific char to go ahead the next statement
+ 2
Yes
+ 2
thanks 😊
+ 1
For example the statement "cin.ignore(10, 'J');" will ignore the first 10 characters (specified by the first parameter) or until the character "J" is found (specified by the second parameter). Both of these parameters are optional and will default to 1 (first parameter) and EOF (second parameter). "
I'm sorry, but can you explain more detail about ' ignore the first 10 characters ' ?
0
and also about the second parameter