C++ Escape Sequence

Escape Sequence

Escape sequence are special character constants provided by C++ which are specially meant for particular purpose. Escape sequences start with backward slash \ followed by a character.

  • \n New Line : Text after this will appear in next line.
    
    #include<iostream.h>
    #include<conio.h>
    Void main(){
    	clrscr();
    	int age;
            cout<<”Hello World \n We are 10x \n Morning Star”;
    	getch();
    }  
    
    Output
    
    Hello World
    We are 10x
    Morning Star
    
    
  • \t Horizontal Tab: Used to Insert 5 spaces
    
    #include<iostream.h>
    #include<conio.h>
    Void main(){
    	clrscr();
    	int age;
            cout<<”Hello World \t We are 10x \t Morning Star”;
    	getch();
    } 
    
    
    Output
    
    
    Hello World	We are 10x	Morning Star
    
    
Back To Top