Blinking Directions

This program prints the << and >> text on screen to display the direction lef and right it looks like it's blinking but it displays the text using a loop. Given below is the program.

#include<stdio.h>
#include<conio.h>
#include<dos.h>
void main()
{
clrscr();
  while(!kbhit())
  {
    delay(500);
    textcolor(RED);
    gotoxy(5,10);
    cprintf("    <<   <<   <<   <<   <<   <<   <<>>   >>   >>   >>   >>   >>   ");
    delay(500);
    textcolor(BLUE);
    gotoxy(5,10);
    cprintf("  <<   <<   <<   <<   <<   <<   <<    >>   >>   >>   >>   >>   >>  ");
    delay(500);
    textcolor(YELLOW);
    gotoxy(5,10);
    cprintf("<<   <<   <<   <<   <<   <<   <<        >>   >>   >>   >>   >>   >>");
  }
}

Output : 

0 Comments:

Post a Comment