home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
No Fragments Archive 10: Diskmags
/
nf_archive_10.iso
/
MAGS
/
FALKMAG
/
FKM_07_2.ZIP
/
WOBLER.S
/
TAB_1.C
< prev
next >
Wrap
C/C++ Source or Header
|
1997-04-28
|
747b
|
38 lines
/* générateur de fichier DAT contenant une fonction mathématique */
/* par Golio Junior */
#include <stdio.h>
#include <math.h>
#define X_MIN 0
#define X_MAX M_PI*8
#define TAILLE_TABLEAU 256
/* nom du fichier créé */
static char nom[]="dat1.dat";
int fonction(float x)
{ return (int)(100+cos(x)*50);
}
int main(void)
{ int i, y;
float x;
FILE *fichier;
if ((fichier=fopen(nom, "w"))==NULL)
{ printf(" Impossible d'ouvrir le fichier %s \n",nom);
return -1;
}
else
{ /* routine de generation */
for (i=0; i<TAILLE_TABLEAU; i++)
{ x=i*(X_MAX-X_MIN)/TAILLE_TABLEAU;
y=fonction(x);
fprintf(fichier, "\tdc.w $%X\n", y);
}
fclose(fichier);
}
return 0;
}