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

can u give me the c codings for converting a string into the hexa decimal form......

1 Answers  


struct Foo { char *pName; }; main() { struct Foo *obj = malloc(sizeof(struct Foo)); clrscr(); strcpy(obj->pName,"Your Name"); printf("%s", obj->pName); } a. Your Name b. compile error c. Name d. Runtime error

3 Answers   HCL,


Write a c program to search an element in an array using recursion

1 Answers   Wipro,


String reverse with time complexity of n/2 with out using temporary variable.

10 Answers   NetApp, Symantec,


main() { char *p; int *q; long *r; p=q=r=0; p++; q++; r++; printf("%p...%p...%p",p,q,r); }

1 Answers  






write a program in c language to get the value of arroy keys pressed and display the message which arrow key is pressed?

1 Answers  


how can i search an element in an array

2 Answers   CTS, Microsoft, ViPrak,


main() { int x=5; for(;x!=0;x--) { printf("x=%d\n", x--); } } a. 5, 4, 3, 2,1 b. 4, 3, 2, 1, 0 c. 5, 3, 1 d. none of the above

2 Answers   HCL,


Hi, i have a project that the teacher want a pyramid of numbers in C# or java...when we click a button...the pyramid should be generated in a listbox/or JtextArea...and the pyramid should have the folowing form: 1 232 34543 4567654 567898765 67890109876 7890123210987 890123454321098 90123456765432109 0123456789876543210 Plz help with codes...didn't find anything on the net.

0 Answers  


Given n nodes. Find the number of different structural binary trees that can be formed using the nodes.

16 Answers   Aricent, Cisco, Directi, Qualcomm,


write a function to give demostrate the functionality of 3d in 1d. function prototye: change(int value,int indexX,int indexY,int indexZ, int [] 1dArray); value=what is the date; indexX=x-asix indexY=y-axis indexZ=z-axis and 1dArray=in which and where the value is stored??

0 Answers   Nagarro,


void func1(int (*a)[10]) { printf("Ok it works"); } void func2(int a[][10]) { printf("Will this work?"); } main() { int a[10][10]; func1(a); func2(a); } a. Ok it works b. Will this work? c. Ok it worksWill this work? d. None of the above

1 Answers   HCL,


Categories