Page 28 - Modular_V2.0_C++_Flikpbook
P. 28

ESCAPE SEQUENCE CHARACTERS

                  Escape sequence characters are used to represent certain  special characters  that cannot  be
                  directly printed on the output screen. They begin with a backslash (\), followed by a specific
                  letter or symbol. Following are some of the important escape sequence characters:


                          Escape Sequence Character                            Description
                                        \'                 Inserts a single quote (')
                                        \"                 Inserts a double quote (")

                                        \?                 Inserts a question mark (?)
                                        \\                 Inserts a backslash (\)

                                        \b                 Moves the cursor one step back (Backspace)
                                        \f                 Moves to a new page (Form feed)

                                        \n                 Moves to a new line (Line break)
                                        \r                 Moves to the beginning of the line (Carriage return)

                                        \t                 Adds a horizontal tab (Space between words)
                                        \v                 Adds a vertical tab (Spaces text vertically)

                  Let us write a C++ program to use the escape sequence characters.

                  #include<iostream.h>
                  #include<conio.h>

                  void main()
                  {

                      clrscr();
                      cout<< "The \\n is used to add\n a line break.\n";

                      cout<< "The \\t is used to add\t horizontal tab.\n";
                      cout<< "1\n1 1\n1 1 1\n1 1 1 1\n";

                      getch();
                  }
                  When you run the above code, you will get the output as shown:

                                             DOSBox 0.74, Cpu speed: max 100% cycles, Frameskip 0,
                                          The \n is used to add
                                           a line break.
                                          The \t is used to add    horizontal tab.
                                          1
                                          1  1
                                          1  1  1
                                          1  1  1  1





                   26
                          Touchpad MODULAR (Ver. 2.0)
   23   24   25   26   27   28   29   30   31   32   33