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 |
Derive expression for converting RGB color parameters to HSV values
prog. to produce 1 2 3 4 5 6 7 8 9 10
abcdedcba abc cba ab ba a a
Given an array of characters which form a sentence of words, give an efficient algorithm to reverse the order of the words (not characters) in it.
void main() { int x,y=2,z; z=(z*=2)+(x=y=z); printf("%d",z); }
code of a program in c language that ask a number and print its decremented and incremented number.. sample output: input number : 3 321123
There is a lucky draw held every day. if there is a winning number eg 1876,then all possible numbers like 1867,1687,1768 etc are the numbers that match irrespective of the position of the digit. Thus all these numbers qualify fr the lucky draw prize Assume there is no zero digit in any numbers. write a program to show all the possible winning numbers if a "winning number"is passed as an arguments to the function.
main() { signed int bit=512, i=5; for(;i;i--) { printf("%d\n", bit = (bit >> (i - (i -1)))); } } a. 512, 256, 128, 64, 32 b. 256, 128, 64, 32, 16 c. 128, 64, 32, 16, 8 d. 64, 32, 16, 8, 4
main() { int i=1; while (i<=5) { printf("%d",i); if (i>2) goto here; i++; } } fun() { here: printf("PP"); }
main() { signed int bit=512, i=5; for(;i;i--) { printf("%d\n", bit >> (i - (i -1))); } } a. 512, 256, 0, 0, 0 b. 256, 256, 0, 0, 0 c. 512, 512, 512, 512, 512 d. 256, 256, 256, 256, 256
main() { char *p; p="Hello"; printf("%c\n",*&*p); }
Is the following code legal? struct a { int x; struct a b; }