Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- /*
- 7. fie clasa EchipaDeFotbal care are ca atribute numele echipei, numele patronului
- si numar de trofee castigate. Fiecare jucator are un nume, un post pe care joaca si
- prima de joc.
- a. Creati un sir de echipe de fotbal si afisati sirul de echipe, pentru fiecare echipa se vor
- afisa informatiile despre fiecare jucator din echipa
- */
- class EchipaDeFotbal
- {
- public:
- string nume_echipa;
- string nume_patron;
- int nr_trofee;
- int nr_jucatori;
- string nume_jucator[1000];
- string post_jucator[1000];
- int prima_joc[1000];
- // Constructor fara parametri
- EchipaDeFotbal(){ cout << "Constructor 1";}
- // Constructor cu parametri
- EchipaDeFotbal(string nume_echipa_m, string nume_patron_m, int nr_trofee_m, int nr_jucatori_m,
- string nume_jucator_m[], string post_jucator_m[], int prima_joc_m[]) {
- this->nume_echipa = nume_echipa_m;
- this->nume_patron = nume_patron_m;
- this->nr_trofee = nr_trofee_m;
- this->nr_jucatori = nr_jucatori_m;
- for(int i=0; i<nr_jucatori_m; i++){
- this->nume_jucator[i] = nume_jucator_m[i];
- this->post_jucator[i] = post_jucator_m[i];
- this->prima_joc[i] = prima_joc_m[i];
- }
- }
- void printInfoJucatori(){
- for(int i=0; i<nr_jucatori; i++){
- cout << "_____________Jucator " << i << "______\n";
- cout << "Nume:" << nume_jucator[i] << "\n";
- cout << "Post:" << post_jucator[i] << "\n";
- cout << "Prima joc:" << prima_joc[i] << "\n";
- cout << "________________________\n";
- }
- }
- };
- int main(){
- // EchipaDeFotbal E[1000];
- string nume_jucator_e1[2] = {"Ion", "Andrei"};
- string post_jucator_e1[2] = {"portar", "jucator111"};
- int prima_joc_e1[2] = {1200, 122};
- string nume_echipa = "Echipa1";
- string nume_patron = "Patronul 1";
- EchipaDeFotbal e1(nume_echipa, nume_patron, 3, 2, nume_jucator_e1, post_jucator_e1, prima_joc_e1);
- e1.printInfoJucatori();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement