12 file.open(
"temperature.txt");
14 cout <<
"Error in file opening!" << endl;
17 ofstream average_file;
18 average_file.open(
"average.txt");
19 if ( average_file.fail() ) {
20 cout <<
"Error in file opening!" << endl;
24 average_file << fixed << setprecision(1);
26 while(getline(file, one_line)){
30 istringstream line_stream(one_line);
34 while(line_stream >> temperature){
38 double average = sum / count;
39 average_file << date <<
" " << average << endl;