Transferer le contenu d’une liste dans un fichier avec l’algorithme ‘copy()’

Author:

 list, list, iterator
Download

#include 
#include 
#include

using namespace std;

int main()
   {
   int arr[] = { 12, 24, 48, 96, 192 };
   list maListe;

   for(int j=0; j<5; j++)
      maListe.push_back( arr[j] );
   ofstream mon_Fichier("test.txt");    

   ostream_iterator output(mon_Fichier, " "); 

   copy(maListe.begin(), maListe.end(), output);
   return 0;
   }

Leave a Reply

Your email address will not be published. Required fields are marked *