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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
|
#include <stdio.h>
#include <gsl/gsl_sf_bessel.h>
#include<gsl/gsl_randist.h>
#include<time.h>
#include<gsl/gsl_rng.h>
#include<math.h>
#include<vector>
#include <iterator>
#include <iostream>
#include <fstream>
using namespace std;
// g++ ecr.cpp -L/home/njepnou/dev/lib -I/home/njepnou/dev/include -lgsl -lgslcblas -lm
int main(){
double u;
gsl_rng *g;
g=gsl_rng_alloc(gsl_rng_mt19937);
gsl_rng_set(g,time(NULL));
u=gsl_rng_uniform(g);
double T[]={4,8,9};
vector<vector<double> >tab(3,vector<double>(1));
int Taille[]={2,5,7};
int i,j;
for (i=0;i<3;i++){
for(j=0;j<Taille[i];j++){
tab[i].push_back(T[i]);
}
}
string const nomFichier("fich.csv");
ofstream monFlux(nomFichier.c_str(),ios::app);
if(monFlux){
for (i=0;i<3;i++){
monFlux << "tableau "<< i << endl;
for(j=0;j<tab[i].size();j++){
monFlux << tab[i][j] << endl;
printf("%f\n", tab[i][j]);
}
}
}
else
{
cout << "ERREUR: Impossible d'écrire dans ce fichier." << endl;
}
return 0;
} |
Partager