#include #include #include //bibliotheque pour ecrire / lire depuis un fichier #include //format des donnes using namespace std; int main() { //ecriture i, j, x, y dans outputfile.dat ofstream fout("outputfile.dat"); //ouverture du fichier outputfile.dat int i = 3, j = 4; fout << setw(10) << i << setw (10) << j << endl; double x = 3.5, y = M_PI; fout << setw(15) << setprecision(6) << x; fout << setw(15) << y; fout << setw(15) << setprecision(4) << y; fout << setw(15) << setprecision(10) << y << endl; //lecture des donnees depuis le meme fichier ifstream fin("outputfile.dat"); //associe fin au fichier outputfile.dat int i1, j1; double x1, y1, y2, y3; fin >> i1 >> j1 >> x1 >> y1 >> y2 >> y3; //affichage des donnees sur l'ecran cout << i1 << "\t" << j1 << "\n" << x1 << "\t" << y1 << "\t" << y2 << "\t" << setprecision(10) << y3 << endl; return 0; }