Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <vector>
- using namespace std;
- class Uzytkownik {
- string login;
- string email;
- bool isPremium;
- public:
- Uzytkownik(string def_login = "default", string def_email = "example@gmail.com", bool def_isPremium = false) {
- login = def_login; email = def_email; isPremium = def_isPremium;
- };
- };
- class Postac : public Uzytkownik {
- friend class Menu;
- string klasa;
- int poziom;
- double zdrowie;
- double mana;
- double atak;
- double obrona;
- public:
- //JAK SIE UZYWA LISTY INICJALIZACYJNEJ ???????????
- Postac(string def_login = "default", string def_email= "example@gmail.com", bool def_isPremium = false, string def_klasa = "Wojownik", int def_poziom = 1, double def_zdrowie = 200, double def_mana = 100, double def_atak = 50, double def_obrona = 25) {
- Uzytkownik(def_login, def_email, def_isPremium); klasa = def_klasa; poziom = def_poziom; zdrowie = def_zdrowie; mana = def_mana; atak = def_atak; obrona = def_obrona;
- }
- void wyswietl_konto();
- };
- class Menu {
- public:
- Menu(int def_wybor = 1) {
- wybor = def_wybor;
- }
- int wybor;
- void wyswietl_menu();
- void wykonaj(int wybor, vector<Postac>& gracze);
- };
- int main() {
- /* WCZYTYWANIE DANYCH Z PLIKU */
- /* SORTOWANIE DANYCH ??? */
- /* LOGOWANIE DLA ADMINISTRATORA, TRZY PROBY */
- vector <Postac> gracze;
- gracze.push_back(Postac());
- gracze.push_back(Postac());
- gracze.push_back(Postac());
- gracze.push_back(Postac()); //zamiast wczytywania z pliku na razie niech bedzie tak
- Menu menu;
- while (menu.wybor != 5)
- {
- menu.wyswietl_menu();
- menu.wykonaj(menu.wybor, gracze);
- }
- return 0;
- }
- void Menu::wyswietl_menu() {
- //tutaj wyswietl menu
- cout << "HALO 123 tutaj wyswietlam menu";
- cin >> wybor;
- }
- void Menu::wykonaj(int wybor, vector<Postac>& gracze) {
- switch (wybor) {
- case 1: //LISTA AKTYWNYCH KONT
- {
- cout << "Lista aktywnych kont: " << endl;
- for (vector<Postac>::size_type i = 0; i < gracze.size(); i++)
- {
- gracze[i].wyswietl_konto();
- }
- break;
- }
- case 2: //STWORZ NOWE KONTO
- {
- string temp_login, temp_email, temp_klasa;
- int temp_poziom;
- double temp_zdrowie, temp_mana, temp_atak, temp_obrona;
- bool temp_isPremium;
- cout << "~ Witaj w kreatorze konta, podaj nastepujace dane ~ " << endl;
- cout << "Podaj login: "; cin >> temp_login;
- cout << "Podaj email: "; cin >> temp_email;
- cout << "Czy uzytkownik ma konto premium (1 - tak/0 - nie): "; cin >> temp_isPremium;
- cout << "Podaj klase postaci: "; cin >> temp_klasa;
- cout << "Podaj poziom uzytkownika: "; cin >> temp_poziom;
- cout << "Podaj ilosc punktow zdrowia: "; cin >> temp_zdrowie;
- cout << "Podaj ilosc punktow many: "; cin >> temp_mana;
- cout << "Podaj ilosc punktow ataku: "; cin >> temp_atak;
- cout << "Podaj ilosc punktow obrony: "; cin >> temp_obrona;
- gracze.push_back(Postac(temp_login, temp_email, temp_isPremium, temp_klasa, temp_poziom, temp_zdrowie, temp_mana, temp_atak, temp_obrona));
- break;
- }
- case 3: //USUN KONTO
- {
- break;
- }
- case 4: //POROWNAJ DWIE POSTACIE
- {
- break;
- }
- case 5: //ZAPISZ DO PLIKU I WYJDZ Z PROGRAMU
- {
- break;
- }
- default: //ZLA OPCJA WPISZ JESZCZE RAZ
- break;
- }
- }
- void Postac::wyswietl_konto() {
- cout << klasa << endl;
- cout << poziom << endl;
- cout << zdrowie << endl;
- cout << mana << endl;
- cout << atak << endl;
- cout << obrona << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement