This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Dec 6th, 2012  |  syntax: None  |  size: 0.81 KB  |  views: 12  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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. }
clone this paste RAW Paste Data