Advertisement
Guest User

main.cpp

a guest
Nov 17th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.01 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <string>
  4. #include "Nagłówek.h"
  5.  
  6. int main() {
  7.     List* lista = new List;
  8.     std::fstream plik;
  9.     std::string slowo[3];  
  10.     plik.open("H:\data3.txt", std::ios::in | std::ios::out);
  11.     if (plik.good()==true) {
  12.         std::string linia;
  13.         std::string przerywnik = ", ";
  14.         while (!plik.eof()) {
  15.             size_t pos = 0;
  16.             int i = 0;
  17.             getline(plik, linia);
  18.             while ((pos = linia.find(przerywnik)) != std::string::npos) {
  19.                 slowo[i] = linia.substr(0, pos);
  20.                 linia.erase(0, pos + przerywnik.length());
  21.                 i += 1;
  22.             }
  23.             pos = linia.find(",");
  24.             linia = linia.substr(0, pos);
  25.             lista->add(slowo[0],stoi(slowo[1]),slowo[2],linia);
  26.         }
  27.     }
  28.     plik.close();
  29.     std::string country = "England";
  30.     lista->show_country(country);
  31.     std::cout << std::endl;
  32.     lista->show_country("France");
  33.     std::cout << std::endl;
  34.     lista->show_clubs_winners();
  35.     std::cout << std::endl;
  36.     lista->show_year(1982);
  37.     lista->show_year(1966);
  38.     lista->show_year(1956);
  39.  
  40.     delete lista;
  41.     return 0;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement