dev syntax help

Dec 18, 2013 at 6:36pm
can some one explain this please?
need help !

1
2
3
  cin.get();
                        std::cin.ignore (std::numeric_limits<std::streamsize>::max(), '\n' );
                        i++;
Dec 18, 2013 at 6:46pm
discard everything until you see a line break.
because `.ignore()' also ask for a maximum number of steps, an "infinite" number is provided
Dec 18, 2013 at 6:49pm
closed account (S6k9GNh0)
cin.get() blocks and returns a character entry (which is after the user somehow feeds data to the stream which is normally after an enter press). Then the next line blocks until it sees an newline (generally after a user presses enter) and discards it. Then the next line increments i.
Last edited on Dec 18, 2013 at 6:50pm
Dec 18, 2013 at 6:53pm
i didnt get it :( i shall be thankful if someone explains it in a simple and detailed way !
Dec 18, 2013 at 7:03pm
^thanx i got it :)

cin.get() wil force the output to remain on the screen
and .ignre.... will discard everyhtng when see a line break :)
Dec 18, 2013 at 9:02pm
> cin.get() wil force the output to remain on the screen
No, ¿the hell you are talking about?
The `.get()' method operates on the input stream, at most it would flush the output.
Last edited on Dec 18, 2013 at 9:03pm
Topic archived. No new replies allowed.