Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- class gracz {
- private:
- string nick;
- string ip;
- int liczba_banow;
- int typ_konta;
- int exp;
- public:
- void setNick(string n){
- nick = n;
- }
- void setIp(string i){
- ip = i;
- }
- void setLiczba_banow(int l){
- liczba_banow = l;
- }
- void setTyp_konta(int t){
- typ_konta = t;
- }
- void setExp(int e){
- exp = e;
- }
- string getNick(){
- return nick;
- }
- string getIp(){
- return ip;
- }
- int getLiczba_banow(){
- return liczba_banow;
- }
- int getTyp_konta(){
- return typ_konta;
- }
- int getExp(){
- return exp;
- }
- void Walka(); // metoda
- void Ban(); //metoda
- gracz() { // konstruktor
- cout << "Dodano nowego gracza. ";
- exp = 0;
- liczba_banow = 0;
- nick = "nick";
- }
- ~gracz() { //destrutkor
- cout << "Konto gracza " << nick << " usunięte";
- };
- };
- class wojownik //pochodna od gracz
- : public gracz
- {
- string nick = "wojownik";
- string ip = "127.1.1.1";
- int liczba_banow = 0;
- int exp = 10;
- public:
- gracz::Walka() { TU COS NIE PYKA
- x=rand()%2+0;
- if(x=1) {
- cout << "Zwycięstwem. Gracz " << nick <<" zdobył 10 pkt. doświadczenia."
- exp += 10;
- }
- else {
- cout << "uuuu... przegrałeś."
- };
- }
- };
- class czarodziej
- : public gracz
- {
- string nick = "czarodziej"; // przypisywanie zmiennych
- string ip = "10.255.120.1";
- int liczba_banow = 0;
- int exp = 20;
- public:
- };
- int main()
- {
- }
- ||=== Build: Debug in LAB 1 (compiler: GNU GCC Compiler) ===|
- D:\Projekty C++\LAB 1\main.cpp|60|warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11|
- D:\Projekty C++\LAB 1\main.cpp|61|warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11|
- D:\Projekty C++\LAB 1\main.cpp|62|warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11|
- D:\Projekty C++\LAB 1\main.cpp|63|warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11|
- D:\Projekty C++\LAB 1\main.cpp|65|error: cannot define member function 'gracz::Walka' within 'wojownik'|
- D:\Projekty C++\LAB 1\main.cpp|80|warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11|
- D:\Projekty C++\LAB 1\main.cpp|81|warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11|
- D:\Projekty C++\LAB 1\main.cpp|82|warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11|
- D:\Projekty C++\LAB 1\main.cpp|83|warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11|
- ||=== Build failed: 1 error(s), 8 warning(s) (0 minute(s), 0 second(s)) ===|
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement