Advertisement
Guest User

Untitled

a guest
Sep 21st, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <string>
  4. #include "funzioni.h"
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9. ifstream file;
  10. string nomefile;
  11.  
  12.  
  13. int dim=0;
  14.  
  15. float *massime= new float[dim];
  16. float *minime=new float[dim];
  17.  
  18. float maxdelmax=0;
  19. float mindelmin=0;
  20.  
  21. cout << "Inserisci il nome del file" << endl;
  22. cin >> nomefile;
  23. file.open(nomefile.c_str());
  24.  
  25. if (!file)
  26. {
  27. cerr << "Il nome del file non è corretto" << endl;
  28. return -1;
  29. }
  30.  
  31. file >> dim;
  32.  
  33. for (int y=0; y<dim; y++)
  34. {
  35. file >> massime[y];
  36. file >> minime[y];
  37. }
  38.  
  39. MaxMin(massime, minime, maxdelmax, mindelmin, dim);
  40.  
  41. cout << "il massimo delle massime è " << maxdelmax << " e il minimo è " << mindelmin << endl;
  42.  
  43. cout << "il valor medio delle massime e il valor medio delle minime è " << ValorMedio(massime, minime, dim)<< endl;
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57. /*delete [] massime;
  58. delete [] minime;*/
  59.  
  60. return 0;
  61.  
  62. }
  63.  
  64. //faccio funzione dove metto i cout passsando le variabili per riferimento con *
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement