Skip to content
Snippets Groups Projects
fichier-ecriture.cpp 318 B
Newer Older
Nicolas M. Thiéry's avatar
Nicolas M. Thiéry committed
#include <fstream>
using namespace std;

int main() {
Nicolas M. Thiéry's avatar
Nicolas M. Thiéry committed
    ofstream flux;                                 // Déclaration
    flux.open("pi.txt");                           // Ouverture
    flux << "Pi vaut à peu près " << 3.14 << endl; // Écriture
    flux.close();                                  // Fermeture
Nicolas M. Thiéry's avatar
Nicolas M. Thiéry committed
}