cin.ignore();

can anyone please tell me when and how do we use cin.ignore(); ??
I don't know the ins and outs but it has something to do with when the user inputs something and presses enter it leaves a '\n' that needs to be ignored.

Would also be interested in knowing the full reason for this to!
Do you mean that this does not move the cursor to the second line when we press enter ?
No i mean that say you have a program that asks you to input a number and you input the number 1, i think the program see's it as 1\n.

What cin.ignore() does is remove the '\n' from the input, as this is the default delimeter. You can specify otherwise.

Again, please correct if I am wrong!
I dont know if you are right or wrong .
There is a reference section on this site that is quite informative. You want to find the section for istream::ignore.
Topic archived. No new replies allowed.