2009-10-30 43 views

回答

21

使用兩個反斜槓\\

4

也許

cout << "\\"; 
4
std::cout << '\\'; 
16

的 '\' 字符是在C和C轉義字符++。您可以輸出與自身逃脫它字面「\」:

cout << "This is a backslash: \\"; 
18

除了所有正確答案,請參閱本作進一步的轉義字符

\a Bell (beep) 
\b Backspace 
\f Formfeed 
\n Newline 
\r Return 
\t Tab 
\\ Backslash 
\' Single quote 
\" Double quote 
\xdd Hexadecimal representation 
\ddd Octal representation 
\? Question mark ('?') 
+0

還有你的正確答案。 ':)' – sbi 2009-10-30 19:17:14

+0

你錯過了一些。還有'\ m'(即非特殊字符)會發生什麼。 – 2009-10-30 19:19:25

+0

@Sbi:右:) 15 – Tom 2009-10-30 21:14:46

0
cout << "\\" << endl; 

相反ENDL你可以的:

cout << "\\ \n";