I made a bouncing ball with collision but it can't work
what is problem
here is the code
the equation is sin trignometric function.Code:# include<iostream.h> # include <conio.h> # include <dos.h> # include <math.h> # include <graphics.h> # define pi 3.14 # define m 1.3 int main() { int r=0; float y0,t; int i; int gd=0,gm=0; initgraph(&gd,&gm,"c\\tc\\bgi"); rectangle(0,10,637,478); setfillstyle(1,WHITE); for(i=1;i<=635;i=i+10) { setfillstyle(1,WHITE); t = m-pi * (2 * m-pi * 100 + m-pi /2) / 180; y0 = abs (200 * sin(t) * exp (-1 * 0.004 * i ) ); setcolor(WHITE); fillellipse(i,470-(int)y0,r,r); delay(5); setfillstyle(1,BLACK); setcolor(BLACK); fillellipse(i,470-(int)y0,r,r); delay(5); } setfillstyle(1,WHITE); t=m-pi*(2*m-pi*i*100+m-pi/2)/180; y0=abs(200*sin(t)*exp(-1*0.004*i)); setcolor(WHITE); fillellipse(i,470-(int)y0,r,r); getch(); closegraph(); restorecrtmode(); return(0); }



LinkBack URL
About LinkBacks


