2002

Grusel++ of the month

Home
Download Source
/******************************************************************************/
/*                                                                            */
/*                                                            FILE: april.cpp */
/*                                                                            */
/*  A Discrete Fourier Transform (DFT)                                        */
/*  ==================================                                        */
/*                                                                            */
/*  Compiled and tested with Visual C++ V6.0                                  */
/*                                                                            */
/*  V1.00   30-APR-2002   P. Tellenbach   http://www.heimetli.ch/             */
/*                                                                            */
/******************************************************************************/

#include <iostream>
#include <cmath>

using namespace std ;

double a[] = { -23.4420,   2.67315, -3.25439, 10.30360,  -3.87508, -4.26250 } ;
double b[] = { -17.9557, -34.66490, -3.59141,  4.64167, -16.25410,  2.48175 } ;

int main()
{
   for( int i = 14; i > 0; i-- )
   {
      double ch = 83.0357 + ((i & 1) ? -11.0714 : 11.0714) ;

      for( int z = 0; z < 6; z++ )
      {
         double angle = (z + 1) * i * 0.4487989505128276054946633404685 ;
         ch += a[z] * cos( angle ) + b[z] * sin( angle ) ;
      }

      cout << static_cast<char>(ch) ;
   }

   return 0 ;
}