#include #include #include int main(int a,char *b[]){ double fs,f,n,deltaf,k,c,vzorky,x,y,y1,y2,p,cas,t,P[10000],*neco,prumer; int i=0,g,h,o; y=0; y1=0; y2=0; p=0; g=0; h=0; o=5; //vzorky=malloc(sizeof (float) * 1000000); //vzorky=neco; fs=atof(b[1]); n=atof(b[2]); f=atof(b[3]); deltaf=fs/n; k=f/deltaf; c=cos(2*M_PI*(k/n)); cas=0.000125; while(scanf("%lf",&vzorky)==1){ t=t+cas; i++; x=vzorky; //printf("%f\n\n",x[i]); if(p==1)y2=y1; y=x+(2*y1*c)-y2; //printf("%lf %lf %lf %lf\n\n",x,y,y1,y2); y1=y; p=1; //printf("its scanning time"); if(t>=0.04){ t=0; P[g]=(y*y)+(y1*y1)-(2*c*y*y1); //printf("%its printing time lf\n\n",P[g]); y=y1=y2=0; if(g>=5){ prumer=(P[0]+P[1]+P[2]+P[3]+P[4])/5; h++; g++; } else{ printf("- "); g++; } if(h>=2){ //printf("%lf %lf\n\n",P[g],prumer); if(P[o]>=prumer){ printf("+ "); g++; o++; } else{ printf("- "); g++; o++; } } } } //printf("%f %f %f %f %f %f %f %f %f %f\n",P[0],P[1],P[2],P[3],P[4],P[5],P[6],P[7],P[8]); //free(vzorky); //hovna nebudou hovnovat pac vzorky cas doba trvani nejsou nasobky 40 printf("\n"); return(0); }