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
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 |
Answer / tsigereda
which is animate downward gravitational force.
Is This Answer Correct ? | 6 Yes | 1 No |
main() { char c; int i = 456; clrscr(); c = i; printf("%d", c); } a. 456 b. -456 c. random number d. none of the above
How can u say that a given point is in a triangle? 1. with the co-ordinates of the 3 vertices specified. 2. with only the co-ordinates of the top vertex given.
main() { char i=0; for(;i>=0;i++) ; printf("%d\n",i); }
Sir... please give some important coding questions asked by product companies..
write a program to count the number the same (letter/character foreg: 's') in a given sentence.
void ( * abc( int, void ( *def) () ) ) ();
main() { int i=1; while (i<=5) { printf("%d",i); if (i>2) goto here; i++; } } fun() { here: printf("PP"); }
main() { int i=5; printf("%d%d%d%d%d%d",i++,i--,++i,--i,i); }
#include <stdio.h> main() { char * str = "hello"; char * ptr = str; char least = 127; while (*ptr++) least = (*ptr<least ) ?*ptr :least; printf("%d",least); }
How do I write a program to print proper subset of given string . Eg :input: abc output:{},{a},{b},{c},{a,b},{a,c},{b,c}, {a,b,c}.I desperately need this program please mail me to saravana6m@gmail.com
What is "far" and "near" pointers in "c"...?
What is the subtle error in the following code segment? void fun(int n, int arr[]) { int *p=0; int i=0; while(i++<n) p = &arr[i]; *p = 0; }