Aug 1, 2012 at 10:41am UTC
What are you trying to do...?
use cin.getchar() instead of cin.get()...
Aug 1, 2012 at 10:43am UTC
I'm still learning. This is part of the code of an exercise of a book. I don't know cin.getchar() yet. Do you spot any error with cin.get()?
Aug 1, 2012 at 10:46am UTC
The problem is that the first loop ends on line 1 because you put a semicolon at the end of the line.
@HiteshVaghani1
What is the difference between cin.getchar() and cin.get()?
Aug 1, 2012 at 10:48am UTC
Oh my god. I knew it had to be something really stupid. And indeed it is.
Thank you very much for all your help.
Aug 3, 2012 at 8:01am UTC
@Peter87
Actually there is not difference between cin.get() and cin.getchar() in working purpose.
For cin.get() we have to include <iostream> and for getchar() we have to include <cstdio>.
Sep 20, 2012 at 1:32pm UTC
here break statement is never reached because of the continue statement used just before the break statement
Last edited on Sep 20, 2012 at 1:32pm UTC