Guest User

Untitled

a guest
Jan 22nd, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <stdio.h>
  4. #include <sstream>
  5. #include <string>
  6.  
  7. // ----------------------
  8. using namespace std;
  9. const string duomenuFailas = "Duom.txt";
  10. const string rezultatuFailas = "Rez.txt";
  11. // ----------------------
  12.  
  13. class dezes
  14. {
  15. private:
  16. string medziaga;
  17. int ilgis;
  18. int plotis;
  19. int aukstis;
  20. int maxSvoris;
  21. int maxSukrauti;
  22.  
  23. public:
  24. dezes();
  25. ~dezes();
  26. dezes(string med, int ilg, int plo, int auk, int maxSv, int maxSu);
  27.  
  28. }
  29.  
  30. void Skaityti(dezes deze[]);
  31.  
  32.  
  33. int main()
  34. {
  35. dezes deze[10];
  36. setlocale(LC_ALL, "Lithuanian");
  37. Skaityti(deze);
  38.  
  39. }
  40.  
  41. dezes::dezes(string med, int ilg, int plo, int auk, int maxSv, int maxSu): medziaga(med), ilgis(ilg), plotis(plo), aukstis(auk),
  42. maxSvoris(maxSv), maxSukrauti(maxSu) { }
  43. dezes::dezes(): medziaga(""), ilgis(0), plotis(0), aukstis(0), maxSvoris(0), maxSukrauti(0) { }
  44. dezes::~dezes() { }
  45.  
  46.  
  47. void Skaityti(dezes deze[])
  48. {
  49. string pav;
  50. int ilg, plot, auk, max1, max2, kiek;
  51. ifstream srautas(duomenuFailas);
  52. srautas >> kiek;
  53.  
  54. for (int i=1; i <= kiek; i++) {
  55. srautas >> pav >> ilg >> plot >> auk >> max1 >> max2;
  56. deze[i] = dezes(pav, ilg, plot, auk, max1, max2);
  57. }
  58. srautas.close();
  59. }
Add Comment
Please, Sign In to add comment