#include #include #include using namespace std; /* Temperatures a Orly en juillet 2015 */ int main(){ const int jours = 31, par_jour = 8; fstream fich1, fich2; int i, j; double t, min, max; ostringstream pyth; fich1.open("temperatures.dat", ios::in); fich2.open("minmax.dat", ios::out); for(i = 1; i <= jours; i++){ min = 1000; max = -1000; for(j = 0; j < par_jour; j++){ fich1 >> t; if(t < min) min = t; if(t > max) max = t; } fich2 << i << " " << min << " " << max << endl; } fich2.close(); fich1.close(); pyth << "A = loadtxt('minmax.dat')\n" << "plot(A[:,0], A[:,1], label='min')\n" << "plot(A[:,0], A[:,2], label='max')\n" << "xlabel('jour de juillet 2015')\n" << "ylabel('temperature (C)')\n" << "legend()\n" ; make_plot_py(pyth); return 0; }