Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # include <stdio.h>
- # include <stdlib.h>
- # include <math.h>
- int main(void)
- {
- double g=10;
- double x0=0.,y0=0.,v0,w0,t=0.,dt;
- double x1,y1,v1,w1; // step-by-step
- double x2,y2; // formula
- int i,n;
- FILE * A;
- A = fopen("sravn.txt","w");
- scanf("%lf",&v0);
- scanf("%lf",&w0);
- scanf("%lf",&x0);
- scanf("%lf",&y0);
- scanf("%lf",&dt);
- scanf("%d",&n);
- v1=v0;
- w1=w0;
- x1=x0;
- x2=x0;
- y1=y0;
- y2=y0;
- for(i=0;i<n;i++)
- {
- fprintf(A,"%lf %lf %lf %lf %lf\n",t,x1,y1,x2,y2);
- t=t+dt;
- x2 = v0*t + x0;
- y2 = y0 + w0*t - g*t*t*(0.5);
- w1 = w1 - g*dt;
- x1 = x1 + v1*dt;
- y1 = y1 + w1*dt;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement