C program to make a colored ROBOT


















C program to make a colored ROBOT



#include <stdio.h>
#include <conio.h>
#include <dos.h>


void main()
{
int x;
int y;
int c=2;
int d=12;
int e=12;
int f=18;
int g=21;
int a=15;
int b=15;
int sp;
int count=0;
int color=0;
clrscr();

while(c!=3)
{
gotoxy(39,c);
textbackground(1);
cprintf(" ");
c++;
}
while(c!=4)
{
gotoxy(36,c);
textbackground(2);
cprintf(" ");
c++;
}

while(c!=5)
{
gotoxy(35,c);
textbackground(4);
cprintf(" ");
c++;
}

while(c!=11)
{
gotoxy(36,c);
textbackground(6);
cprintf(" ");
c++;
}

gotoxy(36,c);
textbackground(6);
cprintf(" ");

while(c!=4)
{
gotoxy(44,c);
textbackground(6);
cprintf(" ");
c--;
}

gotoxy(38,6);
textbackground(15);
cprintf(" ");

gotoxy(42,6);
textbackground(15);
cprintf(" ");

gotoxy(40,7);
textbackground(3);

cprintf(" ");

gotoxy(38,9);
textbackground(5);

cprintf(" ");

while(d!=14)
{
gotoxy(38,d);
textbackground(6);
cprintf(" ");
d++;
}

while(e!=14)
{
gotoxy(42,e);
textbackground(6);
cprintf(" ");
e++;
}
printf("\n");
for(x=1;x<5;x++)
{
for(sp=0;sp<36;sp++)
{
printf(" ");
}
for(y=1;y<8;y++)
{
textbackground(y);
cprintf(" ");
}
printf("\n");
}
gotoxy(35,6);
textbackground(1);
cprintf(" ");

gotoxy(45,6);
textbackground(1);
cprintf(" ");

gotoxy(44,14);
textbackground(2);
cprintf(" ");

gotoxy(32,14);
textbackground(2);
cprintf(" ");

while(a!=16)
{
gotoxy(32,a);
textbackground(2);
cprintf(" ");
a++;

}

while(b!=16)
{
gotoxy(47,b);
textbackground(2);
cprintf(" ");
b++;

}

while(f!=22)
{
gotoxy(37,f);
textbackground(4);
cprintf(" ");
f++;

}

while(g!=17)
{
gotoxy(42,g);
textbackground(4);
cprintf(" ");
g--;

}

gotoxy(35,22);
textbackground(1);
cprintf(" ");

gotoxy(42,22);
textbackground(1);
cprintf(" ");

gotoxy(52,2);
textcolor(4);
cprintf("M");

gotoxy(54,2);
textcolor(4);
delay(1000);
cprintf("A");

gotoxy(56,2);
textcolor(4);
delay(1000);
cprintf("D");

gotoxy(58,2);
textcolor(4);
delay(1000);
cprintf("E");

gotoxy(62,2);
textcolor(4);
delay(1000);
cprintf("B");

gotoxy(64,2);
textcolor(4);
delay(1000);
cprintf("Y :-");

while(count!=6)
{
gotoxy(54,4);
textbackground(0);
textcolor(++color);
delay(200);
cprintf("A");

gotoxy(54,5);
textcolor(++color);
delay(200);
cprintf("S");

gotoxy(54,6);
textcolor(++color);
delay(200);
cprintf("H");

gotoxy(54,7);
textcolor(++color);
delay(200);
cprintf("I");

gotoxy(54,8);
textcolor(++color);
delay(200);
cprintf("S");

gotoxy(54,9);
textcolor(++color);
delay(200);
cprintf("H");
count++;
color++;
break;
}

getch();
}

Output :


0 comments:

Post a Comment