Advertisement
Guest User

Untitled

a guest
Jan 21st, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <string>
  4. #include "Konto.h"
  5. #include <vector>
  6. #include <string>
  7. #include "Transakcja.h"
  8. using namespace std;
  9.  
  10.  
  11.  
  12.  
  13. int main()
  14. {
  15. fstream plik1;
  16. fstream plik2;
  17. vector<Konto> konta;
  18. plik1.open("zad14_2.txt", ios::in);
  19. plik2.open("transakcje.txt", ios::in);
  20. if (plik1.is_open()&&plik2.is_open())
  21. {
  22. cout << "pliki otwarte poprwanie" << endl;
  23. }
  24. std::string numerKonta;
  25. std::string wlasciciel;
  26. string stanKonta;
  27.  
  28. while (!plik1.eof())
  29. {
  30. getline(plik1, numerKonta, ';');
  31. getline(plik1, wlasciciel, ';');
  32. getline(plik1, stanKonta, '\n');
  33. float istanKonta = stof(stanKonta);
  34. Konto nowe = { numerKonta, wlasciciel, istanKonta };
  35. konta.push_back(nowe);
  36. }
  37. string numerObciazonego;
  38. string numerUznanego;
  39. string kwota;
  40. vector<Transakcja> transakcje;
  41. while (!plik2.eof())
  42. {
  43. getline(plik2, numerObciazonego, ';');
  44. getline(plik2, numerUznanego, ';');
  45. getline(plik2, kwota);
  46. float fkwota = stof(kwota);
  47. Transakcja nowa = { numerObciazonego, numerUznanego, fkwota};
  48. transakcje.push_back(nowa);
  49. }
  50.  
  51. przelew(konta, transakcje);
  52. for (auto itr = konta.begin(); itr != konta.end(); itr++)
  53. {
  54. cout << itr->numerKonta << " ";
  55. cout << itr->wlasciciel << " ";
  56. cout << itr->stanKonta << endl;
  57. }
  58. system("pause");
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement