Escape
Sequence
|
Description
|
Command Example
|
Output on screen
|
\n
|
New Line
Cursor moves to beginning of next line
|
cout<<"cbt\nSAM";
|
cbt
SAM_
|
\r
|
Return
Cursor returns to the beginning of same line. And if there are more cout
statement, it overwrites output of current.
|
cout<<"Hello\r";
cout<<"cbtSAM";
|
cbtSAM_
|
\t
|
Tab
Cursor moves to next tab. Each tab is set at 8 character space. By
default there are 10 tabs to distribute screen of 80 columns into 10 part.
|
cout<<"Hello \tcbtSAM";
|
Hello cbtSAM_
|
\b
|
Backspace
This will delete previous character, same as backspace
|
cout<<"Welcome\b";
|
Welcom_
|
\f
|
Form Feed
Cursor moves to next page
|
|
|
\a
|
Bell
On executing \a, it play single beep sound.
|
cout<<"\a";
|
|
\'
|
Single Quote
This will display single quote in output
|
cout<<"\'cbtSAM";
|
'cbtSAM_
|
\"
|
Double Quote
This will display double quote in output
|
cout<<"\"cbtSAM";
|
"cbtSAM_
|
\\
|
Back Slash
This will display back slash in output
|
cout<<"\\Hello";
|
\Hello_
|