From c4f926438dcb8abe805e910399940f79ff643c4b Mon Sep 17 00:00:00 2001 From: ziejd2 Date: Thu, 14 Sep 2017 15:39:41 -0500 Subject: Add files via upload --- sourcecodes/print_structure/structure.c | 97 +++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 sourcecodes/print_structure/structure.c (limited to 'sourcecodes/print_structure/structure.c') diff --git a/sourcecodes/print_structure/structure.c b/sourcecodes/print_structure/structure.c new file mode 100644 index 00000000..cc893a35 --- /dev/null +++ b/sourcecodes/print_structure/structure.c @@ -0,0 +1,97 @@ +#include +#include +#include +#include + +struct st{ +char *name; +double *data; +}*st_tab; + +main(int argc,char *argv[]) +{ +FILE *fp1,*fp2,*fp3; +char line[2500]; +int i,j,rd; +double d,row; +double thr=atof(argv[5]); + +fp1=fopen(argv[2],"r"); +fp2=fopen(argv[3],"w"); + +fp3=fopen(argv[4],"w"); + + +row=0.0; +while(fgets(line,2500,fp1)!=NULL) + row++; + +rd=(int)sqrt(row); + +printf("%d\n",rd); + +fclose(fp1); +fp1=fopen(argv[1],"r"); + +st_tab=(struct st *)malloc(sizeof(struct st)*rd); + +for(i=0;i=st_tab[j].data[i]) + st_tab[j].data[i]=0.0; + + } +} +*/ + +for(i=0;ithr) + fprintf(fp3,"1\t"); + else + fprintf(fp3,"0\t"); + } + fprintf(fp2,"\n"); + fprintf(fp3,"\n"); +} + +} -- cgit 1.4.1