Advertisement
Guest User

Untitled

a guest
Oct 12th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.88 KB | None | 0 0
  1. #ifndef PLANER_H
  2. #define PLANER_H
  3.  
  4. #include <set>
  5. #include <string>
  6. #include <vector>
  7. #include <list>
  8. #include <ostream>
  9.  
  10. namespace lab2
  11. {
  12.  
  13.     class zasob
  14.     {
  15.         std::string nazwa;
  16.         int rozmiar;
  17.  
  18.     public:
  19.         inline zasob(std::string n, int r) : nazwa(n), rozmiar(r) {}
  20.  
  21.         friend std::ostream& operator<<(std::ostream& out, const zasob& z);
  22.  
  23.         //Dodać składowe potrzebne, aby można było utworzyć std::set<zasob>
  24.         friend bool operator<(const zasob& z1, const zasob& z2);
  25.     };
  26.  
  27.     class zadanie
  28.     {
  29.     public:
  30.         std::string nazwa;
  31.         int koszt;
  32.         std::set<zasob> potrzebne_zasoby;
  33.  
  34.         // W etapie 2 dodać konstruktor publiczny pozwalający na utworzenie instancji zadania
  35.         // z trzema argumentami -- nazwą, kosztem (mają po prostu zostać przypisane do odpowiednich pól)
  36.         // i listą inicjującą zasobów, która utworzy
  37.         // zbiór potrzebne_zasoby
  38.         // Wywołanie konstruktora jest w main.cpp w liniach 43-45.
  39.  
  40.         zadanie(std::string nazwa, int koszt, std::initializer_list<zasob> l) : nazwa(nazwa), koszt(koszt), potrzebne_zasoby(l) {};
  41.  
  42.         // Można dodać inne potrzebne składowe.
  43.     };
  44.  
  45.     // Ten operator potrzebny jest w etapie 1
  46.     std::ostream& operator<<(std::ostream& out, const std::set<zasob>& s);
  47.  
  48.     // Ten operator przyda się przy implementacji analogicznego operatora dla klasy
  49.     // projekt w etapie 3
  50.     std::ostream& operator<<(std::ostream& out, const zadanie& z);
  51.  
  52.     class projekt
  53.     {
  54.         std::set<zasob> dostepne_zasoby;
  55.         std::vector<zadanie> wykonane_zadania;
  56.         std::list<zadanie> zadania_w_toku;
  57.  
  58.     public:
  59.  
  60.         // Dodać składowe wymagane a odpowiednich etapach i ewentualne składowe pomocnicze
  61.         bool dodaj_zasob(zasob z);
  62.         const std::set<zasob>& pobierz_dostepne_zasoby() const;
  63.         bool usun_zasob(zasob z);
  64.         bool czy_da_sie_zrealizowac(zadanie z);
  65.     };
  66.  
  67.     // Dodać potrzebne funkcje i ewentualne funkcje pomocnicze
  68. }
  69.  
  70. #endif /* PLANER_H */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement