# Demo entry 6313422

No.1

Submitted by Max Lin on Oct 26, 2016 at 05:12
Language: C. Code size: 1.7 kB.

```#include "SUBK.c"
#include "DRAW.c"
#include "stdio.h"
#include "math.h"
#include "graphics.h"
main()
{
static double p[20][2], vp[20][2], ap[20][2], del;
static double t[10], w[10], e[10],pdraw[370], vpdraw[370], apdraw[370];
static int ic;
double r12, r23, r34, gam;
double pi, dr;
int i;
FILE *fp;
char *m[]={"p", "vp", "ap"};
r12=28.525; r23=3.625; r34=25.15;
gam=0.0;
w[1]=5.0; e[1]=0.0;
e[3]=0.0;
p[1][1]=0.0; p[1][2]=0.0;
p[4][1]=5.6; p[4][2]=8.1;
del=15.0;
pi=4.0*atan(1.0);
dr=pi/180.0;
gam=0.0*dr;
printf("\n Kinematic Parameters of Point D \n");
printf("          deg         m             m/s          m/s^2\n");
if((fp=fopen("FILE1", "w"))==NULL)
{
printf("Cannot open this file.\n");
exit(0);
}
fprintf(fp, "\n Kinematic Parameters of Point C \n");
fprintf(fp, "No        THETA1      SC            VC           AC\n");
fprintf(fp, "          deg         m             m/s          m/s^2\n");
ic=(int)(360.0/del);
for(i=0;i<=ic;i++)
{
t[1]=(i)*del*dr;
bark(1, 2, 0, 1, r12, 0.0, gam, t, w, e, p, vp, ap);
rrrk(1, 2, 4, 3, 2, 3, r23, r34, t, w, e, p, vp, ap);
printf("\n%2d %12.3f %12.3f %12.3f %12.3f", i+1, t[1]/dr, p[2][1], vp[2][1], ap[2][1]);
fprintf(fp, "\n%2d %12.3f %12.3f %12.3f %12.3f", i+1, t[1]/dr, p[2][1], vp[2][1], ap[2][1]);
pdraw[i]=p[2][1];
vpdraw[i]=vp[2][1];
apdraw[i]=ap[2][1];
if((i%10)==0){getch();}
}
fclose(fp);
getch();
draw1(del, pdraw, vpdraw, apdraw, ic, m);
}
```

This snippet took 0.01 seconds to highlight.

Back to the Entry List or Home.