#include<stdlib.h> #include<conio.h> #include<dos.h> #include<graphics.h> #include<ctype.h> void main () { int gd=DETECT,gm; int newx= 0 ,newy= 0 ,inc_y= 5 ; initgraph(&gd,&gm, " " ); cleardevice(); while (!kbhit()) { ellipse( 520 -newx, 200 , 30 , 330 , 90 , 30 ); circle( 450 -newx, 193 , 3 ); line( 430 -newx, 200 , 450 -newx, 200 ); line( 597 -newx, 185 , 630 -newx, 170 ); line( 597 -newx, 215 , 630 -newx, 227 ); line( 630 -newx, 170 , 630 -newx, 227 ); line( 597 -newx, 200 , 630 -newx, 200 ); line( 597 -newx, 192 , 630 -newx, 187 ); line( 597 -newx, 207 , 630 -newx, 213 ); line( 500 -newx, 190 , 540 -newx, 150 +newy); line( 530 -newx, 190 , 540 -newx, 150 +newy); if (newx>= 500 ) newx= 0 ; if (newy>= 82 ) inc_y=- 5 ; newx=newx+ 5 ; if (newy<= 0 ) inc_y= 5 ; newy=newy+inc_y; delay( 50 ); cleardevice(); } cleardevice(); } Hope, i...
Hii Dipin,
ReplyDeleteI tried the pendulam program,but it gives warning
My friend gave this program
#include
#include
#include
#include
void main()
{
int gd=DETECT,gm;
float xc=320,yc=240,x,y,l,r,a,i,rad;
initgraph(&gd,&gm,"C:\\TC\\BGI");
printf("\nEnter the length\n");
scanf("%f",&l);
printf("\nEnter radius\n");
scanf("%f",&r);
printf("\nEnter angle\n");
scanf("%f",&a);
a=a/2;
while(!kbhit)
{
for(i=-a;i<=a;i++)
{
rad=(3.14*i)/180;
x=xc+(l*sin(rad));
y=yc+(l*cos(rad));
line(xc,yc,x,y);
circle(x,y,r);
setfillstyle(SOLID_FILL,10);
floodfill(x,y,10);
delay(30);
cleardevice();
}
for(i=a;i>=-a;i--)
{
rad=(3.14*i)/180;
x=xc+(l*sin(rad));
y=yc+(l*cos(rad));
line(xc,yc,x,y);
circle(x,y,r);
setfillstyle(SOLID_FILL,10);
floodfill(x,y,10);
delay(30);
cleardevice();
}
}
getch();
}
But It didn'nt work out too
Can you plz help me to correct my mistakes
my friend try using header filesthey are dos.h,stdio.h,maths.h,conio.h and graphics.h then it will show u successs........just try it...
ReplyDeleteto dipin:
ReplyDelete#include
#include
#include
#include
int cx=300,cy=100,r=300;
int x=0,y,p;
void path(int dtn)
{
int x1,y1;
setcolor(15);
if(x>=y)
{
exit (0);
}
cleardevice();
if(dtn==1)
{
circle(cx+x,cy+y,20);
line(cx,cy,cx+x,cy+y);
}
else
{
circle(cx-x,cy+y,20);
line(cx,cy,cx-x,cy+y);
}
delay(10);
if(kbhit())
exit(0);
x++;
if(p<0)
p+=2*x+1;
else
{
y--;
p+=2*(x-y)+1;
}
x1=x;
y1=y;
path(dtn);
cleardevice();
if(dtn==1)
{
circle(cx+x1,cy+y1,20);
line(cx,cy,cx+x1,cy+y1);
}
else
{
circle(cx-x1,cy+y1,20);
line(cx,cy,cx-x1,cy+y1);
}
delay(10);
if(kbhit())
exit(0);
}
void main()
{
int gd=DETECT,gm=DETECT;
initgraph(&gd,&gm,"");
cleardevice();
putpixel(300,100,4);
printf("enter 1 if u want to see pendulum");
scanf("%d",&ch);
while(ch!=1)
{
x=0;
y=r;
p=1-r;
path(1);
x=0;
y=r;
p=1-r;
path(0);
}
getch();
}dipin use this may be this will remove ur warnings..........
plzz tel me the coding to show the ticking the clock or minutes hand moving in a clock..
ReplyDeleteplz help me, i need a program of two balls are moving and when they collide,they become fours balls
ReplyDelete