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 |
C program to print magic square of order n where n > 3 and n is odd
main() { char *cptr,c; void *vptr,v; c=10; v=0; cptr=&c; vptr=&v; printf("%c%v",c,v); }
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
What is the main difference between STRUCTURE and UNION?
Is the following code legal? typedef struct a { int x; aType *b; }aType
main() { int x=5; clrscr(); for(;x==0;x--) { printf("x=%d\n”", x--); } } a. 4, 3, 2, 1, 0 b. 1, 2, 3, 4, 5 c. 0, 1, 2, 3, 4 d. none of the above
why the range of an unsigned integer is double almost than the signed integer.
how can i search an element in an array
2 Answers CTS, Microsoft, ViPrak,
main( ) { static int a[ ] = {0,1,2,3,4}; int *p[ ] = {a,a+1,a+2,a+3,a+4}; int **ptr = p; ptr++; printf(“\n %d %d %d”, ptr-p, *ptr-a, **ptr); *ptr++; printf(“\n %d %d %d”, ptr-p, *ptr-a, **ptr); *++ptr; printf(“\n %d %d %d”, ptr-p, *ptr-a, **ptr); ++*ptr; printf(“\n %d %d %d”, ptr-p, *ptr-a, **ptr); }
Is the following code legal? struct a { int x; struct a b; }
#include <stdio.h> main() { char * str = "hello"; char * ptr = str; char least = 127; while (*ptr++) least = (*ptr<least ) ?*ptr :least; printf("%d",least); }
what is oop?