Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // main.cpp
- #include <iostream>
- #include <Firma.h>
- using namespace std;
- int main()
- {
- Firma firma(700);
- firma.dodaj_klienta();
- return 0;
- }
- // Firma.h
- #ifndef FIRMA_H
- #define FIRMA_H
- #include "Mebel.h"
- #include "Klient.h"
- #include <vector>
- using namespace std;
- class Firma
- {
- public:
- Firma(double);
- ~Firma();
- void dodaj_klienta();
- void dodaj_mebel();
- void sprzedaj(Mebel*, Klient*, int);
- int liczba_mebli();
- int liczba_klientow();
- private:
- vector<Mebel*> meble;
- vector<Klient*> klienci;
- double kasa;
- };
- #endif // FIRMA_H
- // Firma.cpp
- #include "Firma.h"
- #include <iostream>
- using namespace std;
- /*class Firma
- {
- public:
- Firma(double);
- ~Firma();
- void dodaj_klienta();
- void dodaj_mebel();
- void sprzedaj(Mebel*, Klient*, int);
- int liczba_mebli();
- int liczba_klientow();
- private:
- vector<Mebel*> meble;
- vector<Klient*> klienci;
- double kasa;
- };*/
- Firma::Firma(double money) : kasa(money)
- {
- }
- Firma::~Firma()
- {
- for(unsigned i = 0; i < meble.size(); ++i)
- delete meble[i];
- for(unsigned i = 0; i < klienci.size(); ++i)
- delete klienci[i];
- }
- void Firma::dodaj_klienta()
- {
- cout << "Podaj dane klienta (imie, nazwisko, nr telefonu): ";
- string imie, nazwisko;
- int numer;
- cin >> imie >> nazwisko >> numer;
- while(numer < 100000000 || numer > 999999999)
- {
- cout << "Wpisano nieprawidlowy numer telefonu, wpisz ponownie: ";
- cin >> numer;
- }
- Klient* klient = new Klient(imie, nazwisko, numer);
- klienci.push_back(klient);
- }
- //void Firma::dodaj_mebel()
- // Mebel.h
- #ifndef MEBEL_H
- #define MEBEL_H
- #include "../head.h"
- #include "Klient.h"
- #include <iostream>
- using namespace std;
- class Mebel
- {
- public:
- Mebel(double, double, double, typ_mebel, double, string, double, int);
- void sprzedaj(Klient*);
- private:
- double wymiar_x;
- double wymiar_y;
- double wymiar_z;
- typ_mebel mebel;
- double masa;
- string nazwa;
- double cena;
- int ilosc;
- };
- #endif // MEBEL_H
- // Mebel.cpp
- #include "Mebel.h"
- /*class Mebel
- {
- public:
- Mebel(double, double, double, typ_mebel, double, string, double, int);
- void sprzedaj(Klient*);
- private:
- double wymiar_x;
- double wymiar_y;
- double wymiar_z;
- typ_mebel mebel;
- double masa;
- string nazwa;
- double cena;
- int ilosc;
- };*/
- Mebel::Mebel(double x, double y, double z, typ_mebel rodzaj, double waga, string name, double price, int ile) :
- wymiar_x(x), wymiar_y(y), wymiar_z(z), mebel(rodzaj), masa(waga), nazwa(name), cena(price), ilosc(ile)
- {
- }
- // head.h
- #ifndef HEAD_H
- #define HEAD_H
- class Firma;
- class Mebel;
- class Klient;
- enum class typ_mebel
- {
- lozko,
- szafa
- };
- #endif // HEAD_H
- // Klient.h
- #ifndef KLIENT_H
- #define KLIENT_H
- #include "Mebel.h"
- #include "../head.h"
- #include <vector>
- #include <iostream>
- using namespace std;
- class Klient
- {
- public:
- Klient(string, string, int);
- void zakup_mebla();
- private:
- string imie;
- string nazwisko;
- int numer_telefonu;
- double wydatki;
- vector<Mebel*> zakupione_meble;
- };
- #endif // KLIENT_H
- // Klient.cpp
- #include "Klient.h"
- /*class Klient
- {
- public:
- Klient(string, string, int);
- void zakup_mebla();
- private:
- string imie;
- string nazwisko;
- int numer_telefonu;
- double wydatki;
- vector<Mebel*> zakupione_meble;
- };*/
- Klient::Klient(string name, string scndname, int telefon) : imie(name), nazwisko(scndname), numer_telefonu(telefon)
- {
- }
- // Lozko.h
- #ifndef LOZKO_H
- #define LOZKO_H
- #include "Mebel.h"
- enum class typ_materac
- {
- piankowy,
- syntetyczny,
- sprezynowy
- };
- enum class typ_rama
- {
- drewniana,
- metalowa,
- plyta
- };
- class Lozko : public Mebel
- {
- public:
- Lozko();
- private:
- typ_materac materac;
- typ_rama rama;
- };
- #endif // LOZKO_H
- // Lozko.cpp
- #include "Lozko.h"
- /*Lozko::Lozko()
- {
- //ctor
- }
- */
- // Szafa.h
- #ifndef SZAFA_H
- #define SZAFA_H
- #include "Mebel.h"
- class Szafa : public Mebel
- {
- public:
- Szafa();
- private:
- bool lustro;
- int liczba_polek;
- };
- #endif // SZAFA_H
- // Szafa.cpp
- #include "Szafa.h"
- /*Szafa::Szafa()
- {
- //ctor
- }
- */
Advertisement
Add Comment
Please, Sign In to add comment