Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <list>
- #include <string>
- using namespace std;
- class game {
- private:
- int x;
- protected:
- int number_of_players;
- };
- class board_game : public game {
- private:
- int x;
- protected:
- int number_of_pawns;
- };
- class card_game : public game {
- private:
- int x;
- protected:
- int number_of_cards;
- };
- class computer_game : public game {
- private:
- int x;
- protected:
- bool online;
- };
- class cooperative : public board_game {
- private:
- int id;
- protected:
- bool traitor;
- public:
- cooperative(int);
- ~cooperative();
- void show_details();
- int get_id();
- };
- cooperative::cooperative(int id_number) {
- bool traitor_mo;
- int players;
- int pawns;
- cout << "Liczba graczy:" << endl;
- cin >> players;
- cout << "Liczba pionków:" << endl;
- cin >> pawns;
- cout << "Czy obecny jest zdrajca? (1 - tak, 0 - nie)" << endl;
- cin >> traitor_mo;
- id = id_number;
- number_of_players = players;
- number_of_pawns = pawns;
- traitor = traitor_mo;
- }
- cooperative::~cooperative() {
- cout << "Objekt usunięty" << endl;
- }
- int cooperative::get_id() {
- return id;
- }
- void cooperative::show_details() {
- cout << "Liczba graczy: " << number_of_players << "/n" << "Liczba pionków: " << number_of_pawns
- << "/n";
- if (traitor) {
- cout << "Zdrajca: obecny" << endl;
- } else {
- cout << "Brak zdrajcy" << endl;
- }
- }
- void mdo_e(list <cooperative> objs, int id_number) {
- for (std::list<cooperative>::iterator it = objs.begin(); it != objs.end(); ++it) {
- if(it->get_id() == id_number){
- objs.remove(*it);
- }
- }
- cooperative obj(id_number);
- objs.push_back(obj);
- }
- //void cooperative::DO(list <cooperative> e_objects) {
- // int temp_id;
- // cout << "Podaj id obiektu który chcesz usunąć" << endl;
- // cin >> temp_id;
- // for (std::list<cooperative>::iterator it = e_objects.begin(); it != e_objects.end(); ++it) {
- // if ((*it).id == temp_id) {
- // e_objects.remove(*it);
- // break;
- // }
- // }
- //
- //}
- //void cooperative::DIR(list <cooperative> e_objects) {
- // cout << "Obiekty E:" << endl;
- // for (std::list<cooperative>::iterator it = e_objects.begin(); it != e_objects.end(); ++it) {
- // cout << "objekt" << it->id << endl;
- // }
- //}
- //cout << "Podaj id obiektu którego szczegóły chcesz zobaczyć" << endl;
- //cin >> temp_id;
- //for (std::list<cooperative>::iterator it = e_objects.begin(); it != e_objects.end(); ++it) {
- //if (it->id == temp_id) {
- class individual : public board_game {
- private:
- int id;
- protected:
- int enemy;
- public:
- individual(int);
- ~individual();
- void show_details();
- int get_id();
- };
- individual::individual(int id_number) {
- int enemy_mo;
- int players;
- int pawns;
- cout << "Liczba graczy:" << endl;
- cin >> players;
- cout << "Liczba pionków:" << endl;
- cin >> pawns;
- cout << "Liczba przeciwników: " << endl;
- cin >> enemy_mo;
- id = id_number;
- number_of_players = players;
- number_of_pawns = pawns;
- enemy = enemy_mo;
- }
- individual::~individual() {
- cout << "Objekt usunięty" << endl;
- }
- int individual::get_id() {
- return id;
- }
- void individual::show_details() {
- cout << "Liczba graczy: " << number_of_players << "/n" << "Liczba pionków: " << number_of_pawns
- << "/n" << "Liczba przeciwników: " << enemy << "/n";
- }
- void mdo_f(list <individual> objs, int id_number) {
- for (std::list<individual>::iterator it = objs.begin(); it != objs.end(); ++it) {
- if(it->get_id() == id_number){
- objs.remove(*it);
- }
- }
- individual obj(id_number);
- objs.push_back(obj);
- }
- class card : public card_game {
- private:
- int id;
- protected:
- int hand;
- public:
- card(int);
- ~card();
- void show_details();
- int get_id();
- };
- card::card(int id_number) {
- int cards_mo;
- int players;
- int hand_mo;
- cout << "Liczba graczy:" << endl;
- cin >> players;
- cout << "Liczba kart:" << endl;
- cin >> cards_mo;
- cout << "Liczba kart na ręce: " << endl;
- cin >> hand_mo;
- id = id_number;
- number_of_players = players;
- number_of_cards = cards_mo;
- hand = hand_mo;
- }
- card::~card() {
- cout << "Objekt usunięty" << endl;
- }
- int card::get_id() {
- return id;
- }
- void card::show_details() {
- cout << "Liczba graczy: " << number_of_players << "/n" << "Liczba kart: " << number_of_cards
- << "/n" << "Liczba kart na ręce: " << hand << "/n";
- }
- void mdo_g(list <card> objs, int id_number) {
- for (std::list<card>::iterator it = objs.begin(); it != objs.end(); ++it) {
- if(it->get_id() == id_number){
- objs.remove(*it);
- }
- }
- card obj(id_number);
- objs.push_back(obj);
- }
- class single : public computer_game {
- private:
- int id;
- protected:
- int enemy;
- public:
- single(int);
- ~single();
- void show_details();
- int get_id();
- };
- single::single(int id_number) {
- bool online_mo;
- int players;
- int enemy_mo;
- cout << "Liczba graczy:" << endl;
- cin >> players;
- cout << "Liczba przecieników:" << endl;
- cin >> enemy_mo;
- cout << "Czy gra jest online? (1 - tak, 0 - nie)" << endl;
- cin >> online_mo;
- id = id_number;
- number_of_players = players;
- online = online_mo;
- enemy = enemy_mo;
- }
- single::~single() {
- cout << "Objekt usunięty" << endl;
- }
- int single::get_id() {
- return id;
- }
- void single::show_details() {
- cout << "Liczba graczy: " << number_of_players << "/n" << "Liczba przeciwników: " << enemy
- << "/n";
- if (online) {
- cout << "Gra online" << endl;
- } else {
- cout << "Gra offline" << endl;
- }
- }
- void mdo_h(list <single> objs, int id_number) {
- for (std::list<single>::iterator it = objs.begin(); it != objs.end(); ++it) {
- if(it->get_id() == id_number){
- objs.remove(*it);
- }
- }
- single obj(id_number);
- objs.push_back(obj);
- }
- class multi : public computer_game {
- private:
- int id;
- protected:
- int team;
- public:
- multi(int);
- ~multi();
- void show_details();
- int get_id();
- };
- multi::multi(int id_number) {
- bool online_mo;
- int players;
- int team_mo;
- cout << "Liczba graczy:" << endl;
- cin >> players;
- cout << "Liczba teamów:" << endl;
- cin >> team_mo;
- cout << "Czy gra jest online? (1 - tak, 0 - nie)" << endl;
- cin >> online_mo;
- id = id_number;
- number_of_players = players;
- online = online_mo;
- team = team_mo;
- }
- multi::~multi() {
- cout << "Objekt usunięty" << endl;
- }
- int multi::get_id() {
- return id;
- }
- void multi::show_details() {
- cout << "Liczba graczy: " << number_of_players << "/n" << "Liczba teamów: " << team
- << "/n";
- if (online) {
- cout << "Gra online" << endl;
- } else {
- cout << "Gra offline" << endl;
- }
- }
- void mdo_i(list <multi> objs, int id_number) {
- for (std::list<multi>::iterator it = objs.begin(); it != objs.end(); ++it) {
- if(it->get_id() == id_number){
- objs.remove(*it);
- }
- }
- multi obj(id_number);
- objs.push_back(obj);
- }
- int main() {
- list <cooperative> e_objects;
- list <individual> f_objects;
- list <card> g_objects;
- list <single> h_objects;
- list <multi> i_objects;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement