Detalii evaluare #65000550

Rezumat problemă

Ai primit definiția unei clase. Implementează toate metodele clasei.

Detalii

Problema oop_numere_complexe Operații I/O tastatură/ecran
Limita timp 0.1 secunde Limita memorie Total: 64 MB / Stivă 8 MB
Id soluție #65000550 Utilizator Iacob Ana Maria (Iacobana123)
Fișier oop_numere_complexe.cpp Dimensiune 1.51 KB
Data încărcării 09 Iulie 2026, 19:25 Scor/rezultat Eroare de compilare

Evaluare

Mesaj compilare

oop_numere_complexe.cpp:32:9: error: expected unqualified-id before ‘int’
   32 | Complex(int pr, int pi)
      |         ^~~
oop_numere_complexe.cpp:32:9: error: expected ‘)’ before ‘int’
   32 | Complex(int pr, int pi)
      |        ~^~~
      |         )
oop_numere_complexe.cpp:38:9: error: expected unqualified-id before ‘)’ token
   38 | Complex()
      |         ^
oop_numere_complexe.cpp: In function ‘void set(int, int)’:
oop_numere_complexe.cpp:46:5: error: invalid use of ‘this’ in non-member function
   46 |     this->i=pi;
      |     ^~~~
oop_numere_complexe.cpp:47:5: error: invalid use of ‘this’ in non-member function
   47 |     this->r=pr;
      |     ^~~~
oop_numere_complexe.cpp: In function ‘double modul()’:
oop_numere_complexe.cpp:51:17: error: invalid use of ‘this’ in non-member function
   51 |     return sqrt(this->i*this->i + this->r*this->r);
      |                 ^~~~
oop_numere_complexe.cpp:51:25: error: invalid use of ‘this’ in non-member function
   51 |     return sqrt(this->i*this->i + this->r*this->r);
      |                         ^~~~
oop_numere_complexe.cpp:51:35: error: invalid use of ‘this’ in non-member function
   51 |     return sqrt(this->i*this->i + this->r*this->r);
      |                                   ^~~~
oop_numere_complexe.cpp:51:43: error: invalid use of ‘this’ in non-member function
   51 |     return sqrt(this->i*this->i + this->r*this->r);
      |                                           ^~~~
oop_numere_complexe.cpp: In function ‘int real()’:
oop_numere_complexe.cpp:56:12: error: invalid use of ‘this’ in non-member function
   56 |     return this->r;
      |            ^~~~
oop_numere_complexe.cpp: In function ‘int imag()’:
oop_numere_complexe.cpp:61:12: error: invalid use of ‘this’ in non-member function
   61 |     return this->i;
      |            ^~~~
oop_numere_complexe.cpp: At global scope:
oop_numere_complexe.cpp:64:1: error: ‘friend’ used outside of class
   64 | friend ostream& operator<<(ostream& out, const Complex& c)
      | ^~~~~~
      | ------
oop_numere_complexe.cpp: In function ‘Complex operator+(Complex)’:
oop_numere_complexe.cpp:83:9: error: ‘int Complex::i’ is private within this context
   83 |     rez.i=this->i+c.i;
      |         ^
oop_numere_complexe.cpp:7:9: note: declared private here
    7 |     int i, r;
      |         ^
oop_numere_complexe.cpp:83:11: error: invalid use of ‘this’ in non-member function
   83 |     rez.i=this->i+c.i;
      |           ^~~~
oop_numere_complexe.cpp:83:21: error: ‘int Complex::i’ is private within this context
   83 |     rez.i=this->i+c.i;
      |                     ^
oop_numere_complexe.cpp:7:9: note: declared private here
    7 |     int i, r;
      |         ^
oop_numere_complexe.cpp:84:9: error: ‘int Complex::r’ is private within this context
   84 |     rez.r=this->r+c.r;
      |         ^
oop_numere_complexe.cpp:7:12: note: declared private here
    7 |     int i, r;
      |            ^
oop_numere_complexe.cpp:84:11: error: invalid use of ‘this’ in non-member function
   84 |     rez.r=this->r+c.r;
      |           ^~~~
oop_numere_complexe.cpp:84:21: error: ‘int Complex::r’ is private within this context
   84 |     rez.r=this->r+c.r;
      |                     ^
oop_numere_complexe.cpp:7:12: note: declared private here
    7 |     int i, r;
      |            ^
oop_numere_complexe.cpp: In function ‘Complex operator-(Complex)’:
oop_numere_complexe.cpp:91:9: error: ‘int Complex::i’ is private within this context
   91 |     rez.i=this->i-c.i;
      |         ^
oop_numere_complexe.cpp:7:9: note: declared private here
    7 |     int i, r;
      |         ^
oop_numere_complexe.cpp:91:11: error: invalid use of ‘this’ in non-member function
   91 |     rez.i=this->i-c.i;
      |           ^~~~
oop_numere_complexe.cpp:91:21: error: ‘int Complex::i’ is private within this context
   91 |     rez.i=this->i-c.i;
      |                     ^
oop_numere_complexe.cpp:7:9: note: declared private here
    7 |     int i, r;
      |         ^
oop_numere_complexe.cpp:92:9: error: ‘int Complex::r’ is private within this context
   92 |     rez.r=this->r-c.r;
      |         ^
oop_numere_complexe.cpp:7:12: note: declared private here
    7 |     int i, r;
      |            ^
oop_numere_complexe.cpp:92:11: error: invalid use of ‘this’ in non-member function
   92 |     rez.r=this->r-c.r;
      |           ^~~~
oop_numere_complexe.cpp:92:21: error: ‘int Complex::r’ is private within this context
   92 |     rez.r=this->r-c.r;
      |                     ^
oop_numere_complexe.cpp:7:12: note: declared private here
    7 |     int i, r;
      |            ^
oop_numere_complexe.cpp: In function ‘Complex operator*(Complex)’:
oop_numere_complexe.cpp:99:9: error: ‘int Complex::r’ is private within this context
   99 |     rez.r=this->r*c.r - this->i*c.i;
      |         ^
oop_numere_complexe.cpp:7:12: note: declared private here
    7 |     int i, r;
      |            ^
oop_numere_complexe.cpp:99:11: error: invalid use of ‘this’ in non-member function
   99 |     rez.r=this->r*c.r - this->i*c.i;
      |           ^~~~
oop_numere_complexe.cpp:99:21: error: ‘int Complex::r’ is private within this context
   99 |     rez.r=this->r*c.r - this->i*c.i;
      |                     ^
oop_numere_complexe.cpp:7:12: note: declared private here
    7 |     int i, r;
      |            ^
oop_numere_complexe.cpp:99:25: error: invalid use of ‘this’ in non-member function
   99 |     rez.r=this->r*c.r - this->i*c.i;
      |                         ^~~~
oop_numere_complexe.cpp:99:35: error: ‘int Complex::i’ is private within this context
   99 |     rez.r=this->r*c.r - this->i*c.i;
      |                                   ^
oop_numere_complexe.cpp:7:9: note: declared private here
    7 |     int i, r;
      |         ^
oop_numere_complexe.cpp:100:9: error: ‘int Complex::i’ is private within this context
  100 |     rez.i= this->r*c.i + this->i*c.r;
      |         ^
oop_numere_complexe.cpp:7:9: note: declared private here
    7 |     int i, r;
      |         ^
oop_numere_complexe.cpp:100:12: error: invalid use of ‘this’ in non-member function
  100 |     rez.i= this->r*c.i + this->i*c.r;
      |            ^~~~
oop_numere_complexe.cpp:100:22: error: ‘int Complex::i’ is private within this context
  100 |     rez.i= this->r*c.i + this->i*c.r;
      |                      ^
oop_numere_complexe.cpp:7:9: note: declared private here
    7 |     int i, r;
      |         ^
oop_numere_complexe.cpp:100:26: error: invalid use of ‘this’ in non-member function
  100 |     rez.i= this->r*c.i + this->i*c.r;
      |                          ^~~~
oop_numere_complexe.cpp:100:36: error: ‘int Complex::r’ is private within this context
  100 |     rez.i= this->r*c.i + this->i*c.r;
      |                                    ^
oop_numere_complexe.cpp:7:12: note: declared private here
    7 |     int i, r;
      |            ^

Cum funcționează evaluarea?

www.pbinfo.ro permite evaluarea a două tipuri de probleme:

  • probleme la care rezolvarea presupune scrierea unui program complet
  • probleme la care rezolvarea presupune scrierea unei secvențe de program - câteva instrucțiuni, o listă de declarații, una sau mai multe funcții, etc.

Problema oop_numere_complexe face parte din a doua categorie. Pentru aceste probleme se folosește un program suport, furnizat de propunătorul problemei. Soluția propusă de tine va fi evaluată astfel:

  • Soluția propusă de tine este inclusă în programul suport, apoi acesta este compilat. Dacă în urma compilării se obțin erori sau avertismente, acestea sunt afișate în această pagină.
  • Datorită existenței programului suport, la compilare pot să apară erori sau avertismente care să nu se refere la instrucțiunile scrise de tine, dar care sunt datorate faptului că soluția ta nu este corectă.
  • Dacă programul suport a fost compilat, executabilul obținut va fi rulat, furnizându-i-se unul sau mai multe seturi de date de intrare, în concordanță cu restricțiile specifice problemei. Pentru fiecare set de date se obține un anumit punctaj, în raport cu corectitudinea soluției tale.

Suma punctajelor acordate pe testele utilizate pentru verificare este 100. Astfel, soluția ta poate obține cel mult 100 de puncte, caz în care se poate considera corectă.

Du-te sus!