If your problem's input says something like
Input
First line of input contains a single positive decimal integer n. This is the number of lines which follow in the input. The next n lines will contain zero or more characters (possibly including white space).Sample Input
3
This is a test.
Count me 1 2 3 4 5.
Wow!!!! Is this question easy?
(Copied form UVA 10008)
Then you can use the following code snippet to take these type of input
If we want to immediately throw away the newline that follows using cin to not mess things up when we later use getline, then use cin.ignore() immediately after a “cin >>” to discard the next value.
(Copied form this link)
No comments:
Post a Comment