count number of line printed out

here it is:

How many lines are printed out by this statement: cout << "abc\ndef\tghi\njkl" << endl << endl << "mno\n\npqr\n";

from what I see, it goes:

abc 1
def ghi 2
jkl 3
4
5
mno 6
7
8
pqr 9
10

The actual answer is 7, and I am counting 10.
Thanks!
abc\n 1
def\tghi\n 2
jkl << endl 3
<< endl 4 (empty line)
mno\n 5
npqr\n 6
7 (empty line)


enjoy
Last edited on
ahh i kinda see it, but I have a question. how come "mno\n\npqr\n"; doesn't make one blank line between MNO and PQR. i see the code like MNO \n\n PQR, so that should make
MNO
blank
PQR

thanks for the help
Last edited on
come to think of it you're right, so that makes it 8 lines unless you don't count the last one because the last one looks something like this:


WORD|
WORD|
|


yeah,looks like im not supposed to count the last line. thanks for your help!
Topic archived. No new replies allowed.