home *** CD-ROM | disk | FTP | other *** search
/ Giga Games 1 / Giga Games.iso / net / go / comp / smooth.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-06-03  |  283 b   |  14 lines

  1. /* This is a simple IIR filter.  Change the magic numbers to taste.  */
  2. #include <stdio.h>
  3.  
  4. main() {
  5.     float avg=0.5,y;
  6.     int count=0,x;
  7.     while (scanf("%d %g\n",&x,&y)!=EOF) {
  8.     avg=0.9995*avg+0.0005*y;
  9.     count++;
  10.     if ((count%250)==1)
  11.         printf("%d %g\n",count,avg);
  12.     }
  13.     }
  14.