Demo entry 6313463

No.2

   

Submitted by Max Lin on Oct 26, 2016 at 05:49
Language: C. Code size: 1.8 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, r25, gam;
    double pi, dr;
    int i;
    FILE *fp;
    char *m[]={"p", "vp", "ap"};
    r12=28.525; r23=3.625; r34=25.15; r25=8.35;
    w[1]=1.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=176.0*dr;
    printf("\n Kinematic Parameters of Point K \n");
    printf("No        THETA1      SK            VK           AK\n");
    printf("          deg         m             m/s          m/s^2\n");
    if((fp=fopen("FILE2", "w"))==NULL)
    {
    	printf("Cannot open this file.\n");
    	exit(0);	
    }
    	
    fprintf(fp, "\n Kinematic Parameters of Point K \n");
    fprintf(fp, "No        THETA1      SK            VK           AK\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, 0.0, t, w, e, p, vp, ap);
    	rrrk(1, 2, 4, 3, 2, 3, r23, r34, t, w, e, p, vp, ap);
    	bark(2, 0, 5, 2, 0.0, r25, gam, t, w, e, p, vp, ap);
    	printf("\n%2d %12.3f %12.3f %12.3f %12.3f", i+1, t[1]/dr, p[5][2], vp[5][2], ap[5][2]);
    	fprintf(fp, "\n%2d %12.3f %12.3f %12.3f %12.3f", i+1, t[1]/dr, p[5][2], vp[5][2], ap[5][2]);
    	pdraw[i]=p[5][2];
    	vpdraw[i]=vp[5][2];
    	apdraw[i]=ap[5][2];
    	if((i%16)==0){getch();}
    }
    fclose(fp);
    getch();
    draw1(del, pdraw, vpdraw, apdraw, ic, m);
}

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).