113k views
2 votes
How many lines are printed out by this statement: cout << "abc\\def\tghi\\jkl" << endl << endl << "mno\\pqr\\";

User JinSnow
by
8.5k points

1 Answer

4 votes

Final answer:

The statement prints out a total of three lines: the first line with three strings, the second line as an empty line, and the third line with two strings.

Step-by-step explanation:

The statement cout << "abc\\def\tghi\\jkl" << endl << endl << "mno\\pqr\\"; prints out a total of three lines.

The first line contains the strings "abc", "def", and "ghi", separated by newline (\\) and tab (\t) escape sequences. This is equivalent to:

abc

def ghi

The second line consists of two consecutive newline escape sequences (endl). This results in an empty line being printed out.

The third line contains the strings "mno" and "pqr", separated by a newline escape sequence (\\). This is equivalent to:

mno

pqr

User Petemoloy
by
7.8k points