Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstring>
- using namespace std;
- class Ekipa {
- protected:
- char name[15];
- int defeats;
- int wins;
- public:
- Ekipa(const char *n = "", int w = 0, int d = 0) {
- strcpy(name, n);
- defeats = d;
- wins = w;
- }
- void pecati() {
- cout << "Ime: " << name << " Pobedi: " << wins << " Porazi: " << defeats;
- }
- };
- class FudbalskaEkipa : public Ekipa {
- private:
- int reds;
- int yellows;
- int draws;
- public:
- FudbalskaEkipa(const char *n = "", int d = 0, int w = 0, int r = 0, int y = 0, int dr = 0) : Ekipa(n, d, w) {
- reds = r;
- yellows = y;
- draws = dr;
- }
- void pecati() {
- Ekipa::pecati();
- cout << " Nereseni: " << draws << " Poeni: " << wins * 3 + draws * 1 << 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