Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <math.h>
- #define v0 20
- #define theta0 60 //graus
- #define y0 60
- #define g 9.8
- #define pi M_PI
- int main (void)
- {
- double rad,tv1,tv2,y,x,t,v0x,v0y;
- rad = 180*theta0/pi;
- v0x=v0*cos(rad);
- v0y=v0*sin(rad);
- tv1=(v0y+sqrt(pow(v0y,2)+2*g*y0))/g; //ver o maior dos valores para tv
- tv2=(v0y-sqrt(pow(v0y,2)+2*g*y0))/g;
- if (tv1==tv2)
- {
- for (t=0.0;t<=tv1;t+=0.1)
- {
- x=v0x*t;
- y=y0+tan(rad)*x-(g*pow(x,2)/(2*pow(v0x,2)));
- printf("%lf\t %lf\t %lf\n",t,x,y);
- }
- }
- if (tv1>tv2)
- {
- for (t=0.0;t<tv1;t+=0.1)
- {
- x=v0x*t;
- y=y0+tan(rad)*x-(g*pow(x,2)/(2*pow(v0x,2)));
- printf("%lf\t %lf\t %lf\n",t,x,y);
- }
- }
- if (tv2>tv1)
- {
- for (t=0.0;t<=tv2;t+=0.1)
- {
- x=v0x*t;
- y=y0+tan(rad)*x-(g*pow(x,2)/(2*pow(v0x,2)));
- printf("%lf\t %lf\t %lf\t %lf\t %lf\n",t,x,y);
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement