1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
double partie_reelle(double x,double y){
return x*x-y*y;
}
double partie_imag(double x,double y){
return 4*y*x;
}
int main()
{
ofstream outfile ("nasdaq.txt",ofstream::binary);
char buffer1[9] ;
char buffer2[9] ;
long size;
for(double k=0;k<=30;k++){
double ima=k/30;
for(double i=0;i<=1000;i++){
double re=-2+i/500;
double x1=partie_reelle(re,ima);
double x2=partie_imag(re,ima);
sprintf(buffer1,"%f",x1);
sprintf(buffer2,"%f",x2);
outfile.write (buffer1,9);
outfile.write (",",2);
outfile.write (buffer2,9);
outfile.write (",",1);
}
outfile.close();
} |
Partager