|
|
|
Escape
Sequences
C++ allows you to use escape sequences to make the compiler
do something such as getting to the next line, performing a
TAB action, producing a quick sound (beep). When you write
your program, you include the (right) escape sequence and C++
will take care of the rest.Various escape sequences behave
differently, but they are always written with a backslash ()
followed by a particular letter or character. Computers and
compilers that follow the American Standard Code Information
Interchange (ASCII) (pronounce aski) recognize these escape
sequences that have a corresponding ASCII value.
Here are the mostly used escape sequences:
Escape Sequence Name ASCII value Description
{There Is A Backslash ( ) Before Each of These Characters}
a --Bell (alert) 007 Makes a sound from the computer
b --Backspace 008 Takes the cursor back
t --Horizontal Tab 009 Takes the cursor to the next tab stop
n --New line 010 Takes the cursor to the beginning of the next
line
v --Vertical Tab 011 Performs a vertical tab
f --Form feed 012
r --Carriage return 013 Causes a carriage return
" --Double Quote 034 Displays a quotation mark (")
' --Apostrophe 039 Displays an apostrophe (')
? --Question mark 063 Displays a question mark
\ --Backslash 092 Displays a backslash ()
--Null 000 Displays a null character
Whenever you use any of these characters, if they are used
inside of a sentence, then you can just include them; if they
are stand-alone, then include them in single or double quotes.
The most popular escape sequences you will be using are the
new line (n) and the horizontal tab (t). The new line can also
be substituted with endl and the result will be the same.
*-kolij-*
|
|