Thursday, 5 September 2013

E P 1 P 4 S

This program includes the use of one more Escape sequence i.e. back-space : '\b', it moves the cursor one position backward.

#include<stdio.h>
#include<dos.h>
main()
{
printf("I");
delay(1000);
printf("       A");
delay(1000);
printf("\b\b\b\b\b\b\bN");
delay(1000);
printf("   I");
delay(1000);
printf("\b\b\bD");
delay(2000);
}




  • We will step by step see the effect of code through pictures

1. printf("I");
    delay(1000);
    printf("       A");

2. printf("\b\b\b\b\b\b\bN");

you can clearly see the effect of 7 '\b' we put in our code. Cursor moves to next position after printing a letter always that is why after printing A we put 7 '\b' instead of 6. Count of '\b' depends on calculation.
  • The program proceed similarly and complete output is given with problem




1 comment: