Write a program to implement the motion of a bouncing ball
using a downward gravitational force and a ground-plane
friction force. Initially the ball is to be projected in to
space with a given velocity vector

Answers were Sorted based on User's Feedback



Write a program to implement the motion of a bouncing ball using a downward gravitational force an..

Answer / tsigereda

#include<dos.h>
#include<iostream.h>
#include<graphics.h>
#include<math.h>
#include<conio.h>
void *ball;
void image()
{
//ball
//setcolor(RED);
setfillstyle(SOLID_FILL,RED);
fillellipse(10,10,10,10);
//ball=malloc(imagesize(0,0,50,50));
//getimage(0,0,50,50,ball);
cleardevice();
}
void main()
{

int d=DETECT,m;
initgraph(&d,&m,"C:\\tc\\bgi");
float x=1,y=0.00000,j=.5,count=.1;
float r=15;
int l=getmaxx()/2,t=0;

image();
setbkcolor(GREEN);

setcolor(30);
line(0,450,650,450);
sleep(1);
for(int k=0;k<=7;k++)
{

for(float i=90;i<270;i+=10)
{
y=cos(((i*22/7)/180))/j;

if(y>0)
y=-y;
x+=5;

setcolor(14);
setfillstyle(1,14);
circle(x,y*200+400,r);
floodfill(x,y*200+400,14);


delay(100);

setcolor(0);
setfillstyle(1,0);
circle(x,y*200+400,r);
floodfill(x,y*200+400,0);

}

j+=count;
count+=.1;
}
getch();
}

Is This Answer Correct ?    11 Yes 3 No

Write a program to implement the motion of a bouncing ball using a downward gravitational force an..

Answer / tsigereda

which is animate downward gravitational force.

Is This Answer Correct ?    6 Yes 1 No

Post New Answer

More C Code Interview Questions

main() { char c=' ',x,convert(z); getc(c); if((c>='a') && (c<='z')) x=convert(c); printf("%c",x); } convert(z) { return z-32; }

1 Answers  


Link list in reverse order.

8 Answers   NetApp,


main() { int i=0; for(;i++;printf("%d",i)) ; printf("%d",i); }

1 Answers   Zoho,


Sir... please give some important coding questions asked by product companies..

0 Answers  


1. const char *a; 2. char* const a; 3. char const *a; -Differentiate the above declarations.

3 Answers  






hello sir,is there any function in C that can calculate number of digits in an int type variable,suppose:int a=123; 3 digits in a.what ll b answer?

6 Answers  


int a = 10 + 10 .... ,... A = A * A What would be the value of A? The answer is 120!! Could anyone explain this to me.

2 Answers   Bosch, eInfochips, HCL, IHCL,


Is it possible to type a name in command line without ant quotes?

1 Answers   Excel, Infosys,


main() { struct student { char name[30]; struct date dob; }stud; struct date { int day,month,year; }; scanf("%s%d%d%d", stud.rollno, &student.dob.day, &student.dob.month, &student.dob.year); }

1 Answers  


Set up procedure for generating a wire frame display of a polyhedron with the hidden edges of the object drawn with dashed lines

0 Answers   IBM,


posted by surbhi just now main() { float a = 5.375; char *p; int i; p=(char*)&a; for(i=0;i<=3;i++) printf("%02x",(unsigned char) p[i]); } how is the output of this program is :: 0000ac40 please let me know y this output has come

2 Answers   GATE,


Write a C function to search a number in the given list of numbers. donot use printf and scanf

5 Answers   Honeywell, TCS,


Categories