#3539
Ai primit definiția unei clase. Implementează toate metodele clasei.
| 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 | |
| Fișier | oop_numere_complexe.cpp | Dimensiune | 1.51 KB |
| Data încărcării | 09 Iulie 2026, 19:25 | Scor/rezultat | Eroare de 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; | ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
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:
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ă.