C program for a dancing doll and a moving car
#include<stdio.h>
#include<conio.h>
#include<graphics.h>
#include<stdlib.h>
void main()
{
int gd=DETECT,gm,i,k,j=0,d;
//Declaration of functions
void stair(); //draws the stair case
void normal(); //draws the normal position
void welcome(); // draws the welcome picture and msg
void bench(); //draws a bench
void st_walk(); //going on a staircase
void rest(); //laying on the bench
void walk(); // to walk
void body1(); //dance step 1[hands]
void body2(); //dance step 2[hands]
void leg1(); // dance step 1 [leg]
void leg2(); //dance step 2 [leg]
void leg3(); // dance step 3 [leg]
void leg4(); //dance step 4 [leg]
void sndrt(); //sound effect in right drum
void sndlt(); //sound effect in left drum
void car(); //draws and move the car
initgraph(&gd,&gm,"");
//draws the bench with the person laying
setcolor(5);
bench();
rest();
delay(5500);
// erases the bench and the person
setcolor(0);
bench();
rest();
// draws the bench and the person moved to normal position
setcolor(5);
bench();
normal();
delay(2500);
// erases the normal position
setcolor(0);
normal();
//makes the person to walk bu calling walk()
setcolor(5);
walk();
//displays the text 'stair case' to show a stair case is needed
outtextxy(480,300,"Stair case");
delay(500);
// draws the stair case
stair();
//erases the msg 'stair case'
setcolor(0);
outtextxy(480,300,"Stair case");
//walks on the stair case
st_walk();
delay(2000);
//erases the stair case
setcolor(0);
stair();
//makes a path for the car and displays the msg 'car'
setcolor(5);
line(250,270,600,270);
outtextxy(260,180,"Car");delay(1000);setcolor(0);outtextxy(260,180,"Car");
//draws the car and moves it by calling car()
car();
//erases the bench and the path
setcolor(0);
bench();
line(250,270,600,270);
// puts a welcome msg and picture by calling welcome
welcome();
//draws the doll and the drums
setcolor(5);
circle(360,160,30);
circle(370,150,2);
circle(346,150,2);
arc(360,160,210,330,15);
line(360,190,360,220);
line(360,205,400,190);
line(360,210,318,190);
circle(360,265,45);
ellipse(450,250,0,360,25,10);
line(475,250,475,290);
line(425,250,425,290);
ellipse(450,290,0,360,25,10);
ellipse(270,250,0,360,25,10);
line(295,250,295,290);
line(245,250,245,290);
ellipse(270,290,0,360,25,10);
delay(200);
//loop to make doll and the person to dance
setcolor(0);
circle(360,265,45);
for(i=0;i<100;i++)
{
if(i%2==0)
{
setcolor(5);
body2();
if(k==0)
leg2();
else
leg1();
circle(355,265,45);
line(400,190,450,250);
line(318,190,270,190);
sndrt();
delay(200);
setcolor(0);
body2();
if(k==0){
leg2();k=1;}
else {
leg1();k=0;}
circle(355,265,45);
sndrt();
line(400,190,450,250);
line(318,190,270,190);
}
else
{
setcolor(5);
body1();
if(j==0)
leg4();
else
leg3();
circle(365,265,45);
line(400,190,450,190);
line(318,190,270,250);
sndlt();
delay(200);
setcolor(0);
body1();
if(j==0){
leg4();j=1;}
else{
leg3();j=0;}
circle(365,265,45);
sndlt();
line(400,190,450,190);
line(318,190,270,250);
}
}
setcolor(5);
circle(360,265,45);
body2();
leg1();
//erases the welcome msg put by the welcome()
setcolor(0);
outtextxy(250,60,"WELCOME TO MUSIC CLUB");
//puts the thank you msg
setcolor(5);
outtextxy(250,60,"THANK YOU");
getch();
// closes the graph
closegraph();
}
void sndrt()
{
line(430,230,425,225);
line(450,225,450,218);
line(470,230,475,225);
}
void sndlt()
{
line(250,230,245,225);
line(270,225,270,218);
line(290,230,295,225);
}
void welcome()
{ setcolor(5);
circle(90,160,20);
line(90,180,90,240);
line(90,180,70,210);
line(90,180,110,210);
line(70,210,110,210);
line(90,240,100,280);
line(90,240,80,280);
outtextxy(250,60,"WELCOME TO MUSIC CLUB");
delay(5000);
setcolor(0);
circle(90,160,20);
line(90,180,90,240);
line(90,180,70,210);
line(90,180,110,210);
line(70,210,110,210);
line(90,240,100,280);
line(90,240,80,280);
}
void body1()
{
circle(90,160,20);
line(90,180,90,240);
line(90,180,120,210);
line(120,210,140,180);
line(90,180,60,200);
line(60,200,50,230);
}
void body2()
{
circle(90,160,20);
line(90,180,90,240);
line(90,180,60,200);
line(60,200,45,170);
line(90,180,130,200);
line(130,200,117,214);
}
void leg4()
{
line(90,240,93,272);
line(93,272,70,300);
line(90,240,110,265);
line(110,265,115,295);
}
void leg3()
{
line(90,240,110,265);
line(110,265,115,295);
line(90,240,88,272);
line(88,272,65,300);
}
void leg2()
{
line(90,240,113,263);
line(113,263,123,295);
line(90,240,85,270);
line(85,270,62,300);
}
void leg1()
{
line(90,240,115,260);
line(115,260,125,295);
line(90,240,60,300);
}
void car()
{
int i,m=463,n=460,l=427,o=546,p=444,q=530,r=527,s=563,t=427,msg=0;
int u=407,v=583,w=536,a=454,b=464,c=526;
for(i=0;i<70;i++)
{
setcolor(5);
line(n,200,q,200);
line(m,208,r,208);
line(m,208,p,227);
line(r,208,o,227);
line(p,227,o,227);
line(n,200,t,233);
line(q,200,s,233);
line(l,233,s,233);
arc(l,253,90,180,20);
arc(s,253,0,90,20);
line(u,253,p,253);
line(v,253,o,253);
circle(a,253,10);
circle(w,253,10);
line(b,253,c,253);
delay(50);
setcolor(0);
line(n,200,q,200);
line(m,208,r,208);
line(m,208,p,227);
line(r,208,o,227);
line(p,227,o,227);
line(n,200,t,233);
line(q,200,s,233);
line(l,233,s,233);
arc(l,253,90,180,20);
arc(s,253,0,90,20);
line(u,253,p,253);
line(v,253,o,253);
circle(a,253,10);
circle(w,253,10);
line(b,253,c,253);
if((i==69)&&(msg==0)){
i=0;msg=1;
setcolor(0);
circle(260,210,10);
line(260,220,260,250);
line(260,250,270,270);
line(260,250,250,270);
line(260,220,270,240);
line(260,220,250,240);
delay(500);
}
else if((i>0)&&(msg==1))
{ if(i==78)
i=100;
l+=2;m+=2;n+=2;o+=2;p+=2;q+=2;r+=2;s+=2;t+=2;u+=2;v+=2;w+=2;a+=2;b+=2;c+=2;
}
else{
l-=2;m-=2;n-=2;o-=2;p-=2;q-=2;r-=2;s-=2;t-=2;u-=2;v-=2;w-=2;a-=2;b-=2;c-=2;}
}
}
void walk()
{
int a=270,b=260,c=280,d=256,e=273,f=275,g=265,h=281,i;
for(i=0;i<60;i++)
{
setcolor(5);
circle(a,350,10);
line(a,360,a,400);
line(a,360,b,385);
line(a,360,c,385);
line(a,400,f,405);
line(f,405,g,412);
line(a,393,h,404);
line(h,404,f,410);
delay(400);
setcolor(0);
circle(a,350,10);
line(a,360,a,400);
line(a,360,b,385);
line(a,360,c,385);
line(a,400,f,405);
line(f,405,g,412);
line(a,393,h,404);
line(h,404,f,410);
setcolor(5);
a+=2;b+=2;c+=2;d+=2;e+=2;
f+=2;g+=2;h+=2;
circle(a,350,10);
line(a,360,a,400);
line(a,360,a,385);
line(a,360,c,385);
line(a,400,d,405);
line(a,392,c,400);
line(c,400,e,410);
delay(400);
setcolor(0);
circle(a,350,10);
line(a,360,a,400);
line(a,360,a,385);
line(a,360,c,385);
line(a,400,d,405);
line(a,392,c,400);
line(c,400,e,410);
a+=2;b+=2;c+=2;d+=2;e+=2;
f+=2;g+=2;h+=2;
setcolor(5);
}
circle(510,350,10);
line(510,360,510,395);
line(510,360,500,385);
line(510,360,520,385);
line(510,395,500,410);
line(510,395,520,410);
delay(2000);
}
void stair()
{
int i,m,n,x=250,y=270;
for(i=0;i<11;i++)
{
n=y+10;
m=x+20;
line(x,y,m,y);
line(m,y,m,n);
delay(150);
x=m;
y=n;
}
}
void st_walk()
{
int x=460,y=310,w=440,l=370,m=345,n=320,p=355,i;
int a=455,b=305,c=315,d=350,e=440,f=360,g=370,h=460;
setcolor(0);
circle(510,350,10);
line(510,360,510,395);
line(510,360,500,385);
line(510,360,520,385);
line(510,395,500,410);
line(510,395,520,410);
delay(1000);
setcolor(5);
circle(x,y,10);
line(x,l,x,n);
delay(450);
for(i=0;i<10;i++)
{
setcolor(5);
circle(x,y,10);
line(x,l,x,n);
line(x,m,w,p);
delay(450);
setcolor(0);
circle(x,y,10);
line(x,l,x,n);
line(x,m,w,p);
setcolor(5);
circle(a,b,10);
line(a,c,a,d);
line(a,d,e,f);
line(a,d,h,g);
delay(450);
setcolor(0);
circle(a,b,10);
line(a,c,a,d);
line(a,d,e,f);
line(a,d,h,g);
setcolor(5);
line(x,l,x,l);
a-=20;e-=20;h-=20;b-=10;c-=10;d-=10;
x-=20;w-=20;f-=10;g-=10;
y-=10;l-=10;m-=10;n-=10;p-=10;
}
circle(260,210,10);
line(260,220,260,250);
line(260,250,270,270);
line(260,250,250,270);
line(260,220,270,240);
line(260,220,250,240);
}
void bench()
{
line(80,280,210,250);
line(80,280,80,360);
line(210,250,210,310);
line(80,340,210,310);
line(250,330,210,310);
line(80,340,120,370);
line(120,370,250,330);
line(120,370,120,390);
line(250,330,250,350);
line(210,342,210,350);
}
void rest()
{
circle(145,275,10);
line(147,285,155,321);
line(147,285,135,325);
line(147,285,170,318);
line(155,321,179,354);
line(155,321,150,360);
line(179,354,179,374);
line(150,360,150,380);
}
void normal()
{
circle(270,350,10);
line(270,360,270,395);
line(270,360,260,385);
line(270,360,280,385);
line(270,395,260,410);
line(270,395,280,410);
}
#include<stdio.h>
#include<conio.h>
#include<graphics.h>
#include<stdlib.h>
void main()
{
int gd=DETECT,gm,i,k,j=0,d;
//Declaration of functions
void stair(); //draws the stair case
void normal(); //draws the normal position
void welcome(); // draws the welcome picture and msg
void bench(); //draws a bench
void st_walk(); //going on a staircase
void rest(); //laying on the bench
void walk(); // to walk
void body1(); //dance step 1[hands]
void body2(); //dance step 2[hands]
void leg1(); // dance step 1 [leg]
void leg2(); //dance step 2 [leg]
void leg3(); // dance step 3 [leg]
void leg4(); //dance step 4 [leg]
void sndrt(); //sound effect in right drum
void sndlt(); //sound effect in left drum
void car(); //draws and move the car
initgraph(&gd,&gm,"");
//draws the bench with the person laying
setcolor(5);
bench();
rest();
delay(5500);
// erases the bench and the person
setcolor(0);
bench();
rest();
// draws the bench and the person moved to normal position
setcolor(5);
bench();
normal();
delay(2500);
// erases the normal position
setcolor(0);
normal();
//makes the person to walk bu calling walk()
setcolor(5);
walk();
//displays the text 'stair case' to show a stair case is needed
outtextxy(480,300,"Stair case");
delay(500);
// draws the stair case
stair();
//erases the msg 'stair case'
setcolor(0);
outtextxy(480,300,"Stair case");
//walks on the stair case
st_walk();
delay(2000);
//erases the stair case
setcolor(0);
stair();
//makes a path for the car and displays the msg 'car'
setcolor(5);
line(250,270,600,270);
outtextxy(260,180,"Car");delay(1000);setcolor(0);outtextxy(260,180,"Car");
//draws the car and moves it by calling car()
car();
//erases the bench and the path
setcolor(0);
bench();
line(250,270,600,270);
// puts a welcome msg and picture by calling welcome
welcome();
//draws the doll and the drums
setcolor(5);
circle(360,160,30);
circle(370,150,2);
circle(346,150,2);
arc(360,160,210,330,15);
line(360,190,360,220);
line(360,205,400,190);
line(360,210,318,190);
circle(360,265,45);
ellipse(450,250,0,360,25,10);
line(475,250,475,290);
line(425,250,425,290);
ellipse(450,290,0,360,25,10);
ellipse(270,250,0,360,25,10);
line(295,250,295,290);
line(245,250,245,290);
ellipse(270,290,0,360,25,10);
delay(200);
//loop to make doll and the person to dance
setcolor(0);
circle(360,265,45);
for(i=0;i<100;i++)
{
if(i%2==0)
{
setcolor(5);
body2();
if(k==0)
leg2();
else
leg1();
circle(355,265,45);
line(400,190,450,250);
line(318,190,270,190);
sndrt();
delay(200);
setcolor(0);
body2();
if(k==0){
leg2();k=1;}
else {
leg1();k=0;}
circle(355,265,45);
sndrt();
line(400,190,450,250);
line(318,190,270,190);
}
else
{
setcolor(5);
body1();
if(j==0)
leg4();
else
leg3();
circle(365,265,45);
line(400,190,450,190);
line(318,190,270,250);
sndlt();
delay(200);
setcolor(0);
body1();
if(j==0){
leg4();j=1;}
else{
leg3();j=0;}
circle(365,265,45);
sndlt();
line(400,190,450,190);
line(318,190,270,250);
}
}
setcolor(5);
circle(360,265,45);
body2();
leg1();
//erases the welcome msg put by the welcome()
setcolor(0);
outtextxy(250,60,"WELCOME TO MUSIC CLUB");
//puts the thank you msg
setcolor(5);
outtextxy(250,60,"THANK YOU");
getch();
// closes the graph
closegraph();
}
void sndrt()
{
line(430,230,425,225);
line(450,225,450,218);
line(470,230,475,225);
}
void sndlt()
{
line(250,230,245,225);
line(270,225,270,218);
line(290,230,295,225);
}
void welcome()
{ setcolor(5);
circle(90,160,20);
line(90,180,90,240);
line(90,180,70,210);
line(90,180,110,210);
line(70,210,110,210);
line(90,240,100,280);
line(90,240,80,280);
outtextxy(250,60,"WELCOME TO MUSIC CLUB");
delay(5000);
setcolor(0);
circle(90,160,20);
line(90,180,90,240);
line(90,180,70,210);
line(90,180,110,210);
line(70,210,110,210);
line(90,240,100,280);
line(90,240,80,280);
}
void body1()
{
circle(90,160,20);
line(90,180,90,240);
line(90,180,120,210);
line(120,210,140,180);
line(90,180,60,200);
line(60,200,50,230);
}
void body2()
{
circle(90,160,20);
line(90,180,90,240);
line(90,180,60,200);
line(60,200,45,170);
line(90,180,130,200);
line(130,200,117,214);
}
void leg4()
{
line(90,240,93,272);
line(93,272,70,300);
line(90,240,110,265);
line(110,265,115,295);
}
void leg3()
{
line(90,240,110,265);
line(110,265,115,295);
line(90,240,88,272);
line(88,272,65,300);
}
void leg2()
{
line(90,240,113,263);
line(113,263,123,295);
line(90,240,85,270);
line(85,270,62,300);
}
void leg1()
{
line(90,240,115,260);
line(115,260,125,295);
line(90,240,60,300);
}
void car()
{
int i,m=463,n=460,l=427,o=546,p=444,q=530,r=527,s=563,t=427,msg=0;
int u=407,v=583,w=536,a=454,b=464,c=526;
for(i=0;i<70;i++)
{
setcolor(5);
line(n,200,q,200);
line(m,208,r,208);
line(m,208,p,227);
line(r,208,o,227);
line(p,227,o,227);
line(n,200,t,233);
line(q,200,s,233);
line(l,233,s,233);
arc(l,253,90,180,20);
arc(s,253,0,90,20);
line(u,253,p,253);
line(v,253,o,253);
circle(a,253,10);
circle(w,253,10);
line(b,253,c,253);
delay(50);
setcolor(0);
line(n,200,q,200);
line(m,208,r,208);
line(m,208,p,227);
line(r,208,o,227);
line(p,227,o,227);
line(n,200,t,233);
line(q,200,s,233);
line(l,233,s,233);
arc(l,253,90,180,20);
arc(s,253,0,90,20);
line(u,253,p,253);
line(v,253,o,253);
circle(a,253,10);
circle(w,253,10);
line(b,253,c,253);
if((i==69)&&(msg==0)){
i=0;msg=1;
setcolor(0);
circle(260,210,10);
line(260,220,260,250);
line(260,250,270,270);
line(260,250,250,270);
line(260,220,270,240);
line(260,220,250,240);
delay(500);
}
else if((i>0)&&(msg==1))
{ if(i==78)
i=100;
l+=2;m+=2;n+=2;o+=2;p+=2;q+=2;r+=2;s+=2;t+=2;u+=2;v+=2;w+=2;a+=2;b+=2;c+=2;
}
else{
l-=2;m-=2;n-=2;o-=2;p-=2;q-=2;r-=2;s-=2;t-=2;u-=2;v-=2;w-=2;a-=2;b-=2;c-=2;}
}
}
void walk()
{
int a=270,b=260,c=280,d=256,e=273,f=275,g=265,h=281,i;
for(i=0;i<60;i++)
{
setcolor(5);
circle(a,350,10);
line(a,360,a,400);
line(a,360,b,385);
line(a,360,c,385);
line(a,400,f,405);
line(f,405,g,412);
line(a,393,h,404);
line(h,404,f,410);
delay(400);
setcolor(0);
circle(a,350,10);
line(a,360,a,400);
line(a,360,b,385);
line(a,360,c,385);
line(a,400,f,405);
line(f,405,g,412);
line(a,393,h,404);
line(h,404,f,410);
setcolor(5);
a+=2;b+=2;c+=2;d+=2;e+=2;
f+=2;g+=2;h+=2;
circle(a,350,10);
line(a,360,a,400);
line(a,360,a,385);
line(a,360,c,385);
line(a,400,d,405);
line(a,392,c,400);
line(c,400,e,410);
delay(400);
setcolor(0);
circle(a,350,10);
line(a,360,a,400);
line(a,360,a,385);
line(a,360,c,385);
line(a,400,d,405);
line(a,392,c,400);
line(c,400,e,410);
a+=2;b+=2;c+=2;d+=2;e+=2;
f+=2;g+=2;h+=2;
setcolor(5);
}
circle(510,350,10);
line(510,360,510,395);
line(510,360,500,385);
line(510,360,520,385);
line(510,395,500,410);
line(510,395,520,410);
delay(2000);
}
void stair()
{
int i,m,n,x=250,y=270;
for(i=0;i<11;i++)
{
n=y+10;
m=x+20;
line(x,y,m,y);
line(m,y,m,n);
delay(150);
x=m;
y=n;
}
}
void st_walk()
{
int x=460,y=310,w=440,l=370,m=345,n=320,p=355,i;
int a=455,b=305,c=315,d=350,e=440,f=360,g=370,h=460;
setcolor(0);
circle(510,350,10);
line(510,360,510,395);
line(510,360,500,385);
line(510,360,520,385);
line(510,395,500,410);
line(510,395,520,410);
delay(1000);
setcolor(5);
circle(x,y,10);
line(x,l,x,n);
delay(450);
for(i=0;i<10;i++)
{
setcolor(5);
circle(x,y,10);
line(x,l,x,n);
line(x,m,w,p);
delay(450);
setcolor(0);
circle(x,y,10);
line(x,l,x,n);
line(x,m,w,p);
setcolor(5);
circle(a,b,10);
line(a,c,a,d);
line(a,d,e,f);
line(a,d,h,g);
delay(450);
setcolor(0);
circle(a,b,10);
line(a,c,a,d);
line(a,d,e,f);
line(a,d,h,g);
setcolor(5);
line(x,l,x,l);
a-=20;e-=20;h-=20;b-=10;c-=10;d-=10;
x-=20;w-=20;f-=10;g-=10;
y-=10;l-=10;m-=10;n-=10;p-=10;
}
circle(260,210,10);
line(260,220,260,250);
line(260,250,270,270);
line(260,250,250,270);
line(260,220,270,240);
line(260,220,250,240);
}
void bench()
{
line(80,280,210,250);
line(80,280,80,360);
line(210,250,210,310);
line(80,340,210,310);
line(250,330,210,310);
line(80,340,120,370);
line(120,370,250,330);
line(120,370,120,390);
line(250,330,250,350);
line(210,342,210,350);
}
void rest()
{
circle(145,275,10);
line(147,285,155,321);
line(147,285,135,325);
line(147,285,170,318);
line(155,321,179,354);
line(155,321,150,360);
line(179,354,179,374);
line(150,360,150,380);
}
void normal()
{
circle(270,350,10);
line(270,360,270,395);
line(270,360,260,385);
line(270,360,280,385);
line(270,395,260,410);
line(270,395,280,410);
}
Hai , This program displays a person in the park moving to the music club through a car and dances according to the music given by the doll .
ReplyDeleteHi sis...
ReplyDeleteNice work with the blog..:)
error: delay should have prototype..
ReplyDeletewww.giztechnewz.blogspot.com
delay() is a predefined method.If u have included the graphics header file properly it will work.
DeleteVashikaran specialist in Delhi This service provide by Muslim baba peer ji, +91-9560189328 ji. he is best astrologer in delhi. A powerful science of attraction Vashikaran is used to solve the problem in one's life and it is a means to attract prosperity and happiness in their lives. It's that date back centuries ago that a practice, but because of its influence, has gained immense popularity in the current moment. Vashikaran expert in Delhi applies not only to India, but has spread to every corner of the world. The basic intent of this program to give you full control on the appropriate person or location, and then to turn it in their favor. During ancient times, the only saint and sage vashikaran practice. They meditate for hours demanding worship the gods and divine blessing. Vashikaran always have someone with good intentions, and causes no harm. Person of the king and the royal family, who say vashikaran service to get you wished your life. Today you will find many offers vashikaran service, but do not have full knowledge of this subject. If you are looking Vashikaran we contacted experts in Delhi for a skilled person in this field.
ReplyDeleteVashikaran specialist in Delhi Is a powerful scientific attraction, one of the means that have been used to deal with problems in a person's life to attract prosperity and happiness in your life. It's that date back centuries ago, which is a warm-up, but thanks to its efficiency, it has achieved great popularity at the moment. Vashikaran realized only in India, but extends to every corner of the world. The main objective of this program is to give you complete control over the appropriate person or location, and then turn it to your advantage. That means in Delhi is known for its excellent team of Tantra and mantra with Vashikaran expert applies vashikaran mantra, is the location where pundits to ask. After his father had taught his capture vashikaran; Vashikaran that blessed his son with the same name is known as a pioneer in the world. Today, Famous jyotish
Get more services :- LOVE MARRIAGE PROBLEM SOLUTION, PROPERTY PROBLEM SOLUTION, DIVORCE PROBLEM SOLUTION, HUSBAND WIFE PROBLEM SOLUTION, FAMILY PROBLEM SOLUTION, CAREER PROBLEM SOLUTION, BUSINESS PROBLEM SOLUTION, LOVE MARRIGE PROBLEM SOLUTION BABA JI, INTER-CASTE PROBLEM IN LOVE MARRAIGE. 20432
I also like programming.
ReplyDeleteBut are you a girl coder.