Demo entry 6313584

No.4

   

Submitted by Max Lin on Oct 26, 2016 at 10:21
Language: C. Code size: 2.0 kB.

#include "stdio.h"
#include "SUBK.c"
#include "DRAW.c"
#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 r78, r16, r67, r12, gam1, r23, r34, r25, gam2;
    double pi, dr;
    int i;
    FILE *fp;
    char *m[]={"p", "vp", "ap"};
    r78=1.39;
    r16=4.0; r67=2.78;
    r12=28.525; gam1=25.0;
    r23=3.625; r34=25.15; 
    r25=8.35; gam2=176.0;
	pi=4.0*atan(1.0);
    dr=pi/180.0;
	w[5]=0.1;
    p[1][1]=0.0; p[1][2]=0.0;
    p[4][1]=5.6; p[4][2]=8.1;
    p[8][1]=2.86; p[8][2]=4.0;
    del=15.0;
    gam1=25.0*dr;gam2=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("FILE4", "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[5]=(i)*del*dr;
    	bark(8, 7, 0, 5, r78, 0.0, 0.0, t, w, e, p, vp, ap);
    	rrrk(1, 1, 7, 6, 1, 4, r16, r67, t, w, e, p, vp, ap);
    	bark(1, 0, 2, 1, 0.0, r12, gam1, 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, gam2, t, w, e, p, vp, ap);
    	printf("\n%2d %12.3f %12.3f %12.3f %12.3f", i+1, t[5]/dr, p[5][1], vp[5][1], ap[5][1]);
    	fprintf(fp, "\n%2d %12.3f %12.3f %12.3f %12.3f", i+1, t[5]/dr, p[5][1], vp[5][1], ap[5][1]);
    	pdraw[i]=p[5][1];
    	vpdraw[i]=vp[5][1];
    	apdraw[i]=ap[5][1];
    	if((i%16)==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.

Delete this entry (admin only).