123456789101112131415161718
for(coloumns=0; p>=3600; coloumns++) { i++; ofstream outFile; outFile.open("byhour.txt"); if(outFile.fail()) { cerr << "Error, the file cannot be opened." << endl; exit(1); } outFile << i << " " << accumulatedPower/3600000 << endl; accumulatedPower=0; p=0; } .