- #1
chaoseverlasting
- 1,050
- 3
Hi,
I've a basic knowledge of c++, but I've never learned graphing. What little I know, I've picked up myself. I am trying to graph the motion of a projectile launched with a given speed and at a given angle, but the graph doesn't complete. Also, its very spaced out. I know its a parabola so I can recognise it, otherwise, it very broken up. Can anyone tell me a better way to do this? Here's the code:
r=pow(v,2)*(sin(2*a))/10; //Range
s=v*sin(a);
c=v*cos(a);
for(t=0;x<=r;t=t+0.5) /*Here, instead of the range, I've also tried to use total time taken, but still the graph doesn't go to completion*/
{
x=c*t;
y=s*t - 5*t*t;
gotoxy(x,y);
cout<<".";
}
getch();
If anyone wants to see the whole program, Ill put it up.
I've a basic knowledge of c++, but I've never learned graphing. What little I know, I've picked up myself. I am trying to graph the motion of a projectile launched with a given speed and at a given angle, but the graph doesn't complete. Also, its very spaced out. I know its a parabola so I can recognise it, otherwise, it very broken up. Can anyone tell me a better way to do this? Here's the code:
r=pow(v,2)*(sin(2*a))/10; //Range
s=v*sin(a);
c=v*cos(a);
for(t=0;x<=r;t=t+0.5) /*Here, instead of the range, I've also tried to use total time taken, but still the graph doesn't go to completion*/
{
x=c*t;
y=s*t - 5*t*t;
gotoxy(x,y);
cout<<".";
}
getch();
If anyone wants to see the whole program, Ill put it up.