#include<stdio.h>#include<stdlib.h>void main(){ FILE *fp; char ch; long int i; long int A[1000000],T[1000000],C[1000000],G[1000000]; float H[1000000]; i=0; for(i=1;i<=1000000;i++) { A[i]=0; T[i]=0; C[i]=0; G[i]=0; H[i]=0; } if((fp=fopen("c:\\abc.fna","rb"))==NULL) { printf("can not open the file!\n"); exit(0); } i=0; while(!feof(fp)) { ch=fgetc(fp); switch(ch) { case 'A' : i++; A[i]=A[i-1]+1; T[i]=T[i-1]; C[i]=C[i-1]; G[i]=G[i-1]; break; case 'T' : i++; A[i]=A[i-1]; T[i]=T[i-1]+1; C[i]=C[i-1]; G[i]=G[i-1]; break; case 'C' : i++; A[i]=A[i-1]; T[i]=T[i-1]; G[i]=G[i-1]; C[i]=C[i-1]+1; break; case 'G' : i++; A[i]=A[i-1]; T[i]=T[i-1]; C[i]=C[i-1]; G[i]=G[i-1]+1; break; } } for(i=1;i<1000000;i++){ H[i]=((float)C[i]-(float)G[i])/((float)C[i]+(float)G[i]);}i=1;while(H[i]!=0){ printf("%d\t%f\n",i,H[i]);} fclose(fp); }
0x004117a7 处未处理的异常: 0xC00000FD: Stack overflow