Apr 2, 2013 at 5:04am UTC
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!
Apr 2, 2013 at 5:13am UTC
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 Apr 2, 2013 at 5:16am UTC
Apr 2, 2013 at 5:26am UTC
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 Apr 2, 2013 at 5:26am UTC
Apr 2, 2013 at 12:29pm UTC
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|
|
Apr 2, 2013 at 3:25pm UTC
yeah,looks like im not supposed to count the last line. thanks for your help!