[Help] C++, ignore() function

Questions about programming languages and debugging
Post Reply
User avatar
ayu
Staff
Staff
Posts: 8109
Joined: 27 Aug 2005, 16:00
18
Contact:

[Help] C++, ignore() function

Post by ayu »

Ok so i was reading in my C++ book today and i got to a small program that was using the ignore() function. I have used it before but it was about a year ago and i was learning PHP between so i can't remember how to use it.

The program looks like this http://code.suck-o.com/12


The book says that without "cin.ignore(10, '\n')", at least one return sign would be left in the buffert. And my question is, what does it matter if it's left in the buffert? Would it affect the return c; ? or what ?
"The best place to hide a tree, is in a forest"

User avatar
Nerdz
The Architect
The Architect
Posts: 1127
Joined: 15 Jun 2005, 16:00
18
Location: #db_error in: select usr.location from sucko_member where usr.id=63;
Contact:

Post by Nerdz »

Hmmm I never heard of ignore... so I never used it :?

Annd the the time I did menu or Yes/No interface, I've always use char with most of the time conio.h for the getch function(you doesn't need to press enter for the program to take your char...)

So I would say that you override the buffer each time you get in your loop...

You migth read this:
http://bytes.com/forum/thread128530.html
Give a man a fish, you feed him for one day.
Learn a man to fish, you feed him for life.

Post Reply