Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<cstring>
- using namespace std;
- class Ekipa
- {
- protected:
- char ime[15];
- int pobedi;
- int porazi;
- void copy(const Ekipa &e)
- {
- strcpy(this->ime,e.ime);
- this->pobedi=e.pobedi;
- this->porazi=e.porazi;
- }
- public:
- Ekipa(char *ime= "" , int pobedi = 0 , int porazi = 0)
- {
- strcpy(this->ime,ime);
- this->pobedi=pobedi;
- this->porazi=porazi;
- }
- Ekipa (const Ekipa &e)
- {
- copy (e);
- }
- void pecati()
- {
- cout<<"Ime: "<<ime<<" Pobedi: "<<pobedi<<" Porazi: "<<porazi<<endl;
- }
- };
- class FudbalskaEkipa : public Ekipa
- {
- protected:
- int ck;
- int zk;
- int neresheni;
- public:
- FudbalskaEkipa(char *ime= "",int pobedi=0,int porazi=0,int ck=0,int zk=0,int neresheni=0):Ekipa(ime,pobedi,porazi)
- {
- this->ck=ck;
- this->zk=zk;
- this->neresheni=neresheni;
- }
- int poeni()
- {
- return pobedi*3+neresheni;
- }
- void pecati()
- {
- cout<<"Ime: "<<ime<<" Pobedi: "<<pobedi<<" Porazi: "<<porazi<<" Nereseni: "<<neresheni<<" Poeni: "<<poeni()<<endl;
- }
- };
- int main(){
- char ime[15];
- int pob,por,ck,zk,ner;
- cin>>ime>>pob>>por>>ck>>zk>>ner;
- FudbalskaEkipa f1(ime,pob,por,ck,zk,ner);
- f1.pecati();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement