Advertisement
rihardmarius

final 3a - temperaturas del mundo

Nov 23rd, 2013
336
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.87 KB | None | 0 0
  1. #include <iostream>
  2. #include <array>
  3. #include <fstream>
  4. #include "archivos.h"
  5.  
  6. using namespace std;
  7.  
  8. struct archivo_t {
  9.     int dia;
  10.     int hora;
  11.     int lat;
  12.     int longitud;
  13.     double temp;
  14. };
  15.  
  16. struct array_t {
  17.     double temp = 0;
  18.     int count = 0;
  19. };
  20.  
  21. int main()
  22. {
  23.     array<array_t,181> arr; int norte = 0, norte_c = 0, sur = 0, sur_c = 0;
  24.     archivo_t R;
  25.     ifstream medidas ("medidas.dat", ios::binary);
  26.     while(leerEspecial(medidas, R))
  27.     {
  28.         arr.at(R.lat+90).temp += R.temp;
  29.         arr.at(R.lat+90).count++;
  30.         if (R.lat > 0)
  31.         {
  32.             norte = norte + R.temp
  33.             norte_c++;
  34.         }
  35.         else if (R.lat < 0)
  36.         {
  37.             sur = sur + R.temp;
  38.             sur_c++;
  39.         }
  40.     }
  41.     if (norte/norte_c > sur/sur_c)
  42.         cout << "el norte es mas calido" << endl;
  43.     else if (norte/norte_c < sur/sur_c)
  44.         cout << "el sur es mas calido" << endl;
  45.     else
  46.         cout << "son igual de calidos" << endl;
  47.     medidas.close();
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement