#include void main() { ifstream data; ofstream Gout; ofstream Sout; ofstream Iout; ofstream Gavg; ofstream Iavg; ofstream Savg; ofstream Gpnt; ofstream Spnt; ofstream Ipnt; ofstream SIrat; ofstream IGrat; ofstream SIdif; double itime; double gtime; double time; int order; int mult; char type; double Gtime[504]; int Gmult[504]; double Itime[504]; int Imult[504]; double Stime[504]; int Smult[504]; for(int i = 0; i < 504; i++) { Gtime[i] = 0; Gmult[i] = 0; Stime[i] = 0; Smult[i] = 0; Itime[i] = 0; Imult[i] = 0; } data.open("Analysis.dat"); Gout.open("Gpoints.dat"); Sout.open("Spoints.dat"); Iout.open("Ipoints.dat"); //SIrat.open("SIratio.dat"); IGrat.open("IGratio.dat"); SIdif.open("SIdifference.dat"); data >> time; data >> order; data >> mult; data >> type; while(!data.eof()) { if(type == 'G') { Gtime[order-1] += time; Gmult[order-1] += mult; //Gpnt << order << " " << time/mult << endl; Gout << order << " " << time/mult << endl; gtime = time; } else if (type == 'I') { Itime[order-1] += time; Imult[order-1] += mult; // Ipnt << time << " " << order << " " << mult << endl; Iout << order << " " << time/mult << endl; itime = time; } else if(type == 'S') { Stime[order-1] += time; Smult[order-1] += mult; // Spnt << time << " " << order << " " << mult << endl; Sout << order << " " << time/mult << endl; //SIrat << order << " " << time/itime << endl; IGrat << order << " " << gtime/itime << endl; SIdif << order << " " << time - itime << endl; } data >> time; data >> order; data >> mult; data >> type; } data.close(); Gout.close(); Sout.close(); Iout.close(); //Gpnt.close(); //Spnt.close(); //Ipnt.close(); IGrat.close(); //SIrat.close(); SIdif.close(); Gavg.open("Gaverage.dat"); Savg.open("Saverage.dat"); Iavg.open("Iaverage.dat"); ofstream GIravg; ofstream SIdifavg; SIdifavg.open("SIdiffavg.dat"); GIravg.open("IGratavg.dat"); for(int i = 0; i < 504; i++) { if(Gmult[i] != 0) { Gavg << i+1 << " " << Gtime[i]/Gmult[i] << endl; Savg << i+1 << " " << Stime[i]/Smult[i] << endl; Iavg << i+1 << " " << Itime[i]/Imult[i] << endl; GIravg << i+1 << " " <<( Gtime[i]/Itime[i]) << endl; SIdifavg << i+1 << " " << ( Stime[i]/Smult[i]) - (Itime[i]/Imult[i]) << endl; } } SIdifavg.close(); GIravg.close(); Gavg.close(); Savg.close(); Iavg.close(); }