#include<stdio.h>
#include<conio.h>
#include<dos.h>
void print(char c,int x,int y);
void main()
{
char a[3]={'A','L','I'};
    int i=0,x=1,y=1;
    while(i<3)
    {
    print(a[i],y,x);
    i++;
    }
}
void print(char c,int x,int y)
{
int s=1,a;
if(c=='A')
{
while(!kbhit())
{
    clrscr();
    gotoxy(x,y);
    printf("*****");
    gotoxy(x,y+1);
    printf("*   *");
    gotoxy(x,y+2);
    printf("*   *");
    gotoxy(x,y+3);
    printf("*   *");
    gotoxy(x,y+4);
    printf("*****");
    gotoxy(x,y+5);
    printf("*   *");
    gotoxy(x,y+6);
    printf("*   *");
    gotoxy(x,y+7);
    printf("*   *");
    gotoxy(x,y+8);
    printf("*   *");
    gotoxy(x,y+9);
    printf("*   *");
    delay(500);

    gotoxy(s,13);
    printf("*");
    gotoxy(s,14);
    printf("*");
    gotoxy(s,15);
    printf("*");
    gotoxy(s,16);
    printf("*");
    gotoxy(s,17);
    printf("*");
    gotoxy(s,18);
    printf("*");
    gotoxy(s,19);
    printf("*");
    gotoxy(s,20);
    printf("*");
    gotoxy(s,21);
    printf("*");
    gotoxy(s,22);
    printf("*****");
    x=(x+1);
    if(x==77){
    x=1;
    }
    a=getch();
    if(a==0){a=getch();}
    if(a==32){break;}
    if(a==77){
      s=(s+1)%76;
      if(s==0){
      s=75;}
      }
      if(a==75)
      {
      s=(s-1);
      if(s==0){
      s=1;}
      }
    }
}
if(c=='L')
{
while(1)
{       clrscr();
    gotoxy(x,y);
    printf("*");
    gotoxy(x,y+1);
    printf("*");
    gotoxy(x,y+2);
    printf("*");
    gotoxy(x,y+3);
    printf("*");
    gotoxy(x,y+4);
    printf("*");
    gotoxy(x,y+5);
    printf("*");
    gotoxy(x,y+6);
    printf("*");
    gotoxy(x,y+7);
    printf("*");
    gotoxy(x,y+8);
    printf("*");
    gotoxy(x,y+9);
    printf("*****");
    delay(500);
    gotoxy(s,y+13);
    printf("***");
    gotoxy(s,y+14);
    printf(" *");
    gotoxy(s,y+15);
    printf(" *");
    gotoxy(s,y+16);
    printf(" *");
    gotoxy(s,y+17);
    printf(" *");
    gotoxy(s,y+18);
    printf(" *");
    gotoxy(s,y+19);
    printf(" *");
    gotoxy(s,y+20);
    printf(" *");
    gotoxy(s,y+21);
    printf(" *");
    gotoxy(s,y+22);
    printf("***");
    x=(x+1);
    if(x==77){
    x=1;
    }
    a=getch();
    if(a==0){a=getch();}
    if(a==32){break;}
    if(a==77){
      s=(s+1)%77;
      if(s==0){
      s=76;}
      }
      if(a==75)
      {
      s=(s-1);
      if(s==0){
      s=1;}
      }
}}
if(c=='I')
{
while(1)
{       clrscr();
    gotoxy(x,y);
    printf("***");
    gotoxy(x,y+1);
    printf(" *");
    gotoxy(x,y+2);
    printf(" *");
    gotoxy(x,y+3);
    printf(" *");
    gotoxy(x,y+4);
    printf(" *");
    gotoxy(x,y+5);
    printf(" *");
    gotoxy(x,y+6);
    printf(" *");
    gotoxy(x,y+7);
    printf(" *");
    gotoxy(x,y+8);
    printf(" *");
    gotoxy(x,y+9);
    printf("***");
    delay(500);

    if(kbhit()){
    a=getch();
    if(a==0){a=getch();}
    if(a==32){break;}
    }}
    x=(x+1);
    if(x==77){
    x=1;
}
}
}

"A" is scroll atomatically
when we press left key "L" move to left and when we press right they move right side.
but Turbo C++ not perform it at a time.
please cheak this and find the error

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.