Home » » The Escape Sequences in C++ - Example program 03

The Escape Sequences in C++ - Example program 03

The Escape Sequences in C++ - Example program 03
 
Write a C++ program to print the following shape by using single cout statement with the help of escape sequences. 
 
SAMPLE OUTPUT
 
X
X        X
X        X         X
X        X         X         X
X        X         X         X        X
 
It is very simple program and can be handled by using Escape Sequences "\t" (it is used to insert 8 spaces) and "\n" (it is used to transfer control to the next statement).  
 
See program output:
 


Program CODE:
 
#include<iostream.h>
#include<conio.h>
main(){
clrscr();
cout<<"X\nX\tX\nX\tX\tX\nX\tX\tX\tX\nX\tX\tX\tX\tX";
}


Thanks for visiting The Escape Sequences in C++ - Example program03
Download 
  more from: CS Adventures

0 comments:

Post a Comment

LIKE US

Popular Posts

My FANS around the WORLD

Flag Counter