Bouncing Ball

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

void main() 
{ 
    int gd=DETECT,gm=DETECT; 
    int x,y=0,j,t=400,c=1; 
    initgraph(&gd,&gm,""); 
    setcolor(RED); 
    setfillstyle(SOLID_FILL,RED); 
    for(x=40;x<602;x++) 
    { 
        cleardevice(); 
        circle(x,y,30); 
        floodfill(x,y,RED); 
        delay(40); 

        if(y>=400) 
        { 
            c=0; 
            t-=20; 
        } 
        if(y<=(400-t))
            c=1; 
        y=y+(c?15:-15);

    } 

    getch(); 
}

Comments

  1. hii. thanks for graphics program!!it help me a lot!!my practical subject is computer graphics and multimedia and i'm so confused about multimedia program(sry...i'm an school of distance education student!! thatz wy..??)will u plz help me to find some programs using multimedia packages!!its so urgent!!plzz.....thank u..!

    ReplyDelete

Post a Comment

Popular posts from this blog

Fish Movement

Pendulum

Moving Wheel