Saturday, June 29, 2013

Moving text without using graphics fuction

Problem:
Program to moving the text horizontally , for this purpose we need to know the width of the output screen, so that we make an circular rotation.to see the movement of text without specifying width of the screen.
Solution:
//width of the output screen
#include<stdio.h>
#include <conio.h>
#include<dos.h>

int main(void)

int x=0;
clrscr();

while (!kbhit()
{
clrscr();
gotoxy(x, 12);
printf("Hello world");
delay(100);//delay the control flow
x++;

if (x>=81)//width of the screen
  {
  x=0;//once it reach end of the screen , reset to beginning 

   }
}

printf(" /n width of the screen %d",x);
getch();
return 0;
}


Output:
click the below video to see output






Like the Post? Do share with your Friends.

1 comment: