1. temperatures_in >> low >> high;
  2. tempMin=low;
  3. tempMax=high;
  4. getLocation(temperatures_in, location);
  5.  
  6. while(!temperatures_in.eof()){
  7. temperatures_out << left << setw(20) << location;
  8. temperatures_out << right << fixed << showpoint << setprecision(2) << setw(6) << low << setw(6) << high << endl;
  9. temperatures_in >> low >> high;
  10. getLocation(temperatures_in, location);
  11. if(low<tempMin){
  12. tempMin=low;
  13. }
  14. if(high>tempMax){
  15. tempMax=high;
  16. }
  17. cout << low << " " << tempMin << " " << high << " " << tempMax << " " << location;
  18. }
  19.  
  20. void getLocation(ifstream &temperatures_in, string &location){
  21. char a;
  22. temperatures_in.get(a);
  23. while(a==' '){
  24. temperatures_in.get(a);
  25. }
  26. location="";
  27. while(a!='n'){
  28. location+=a;
  29. temperatures_in.get(a);
  30. }
  31. }