#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 | #63533425 | Utilizator | |
| Fișier | oop_numere_complexe.cpp | Dimensiune | 1.28 KB |
| Data încărcării | 08 Martie 2026, 10:57 | Scor/rezultat | Eroare de compilare |
oop_numere_complexe.cpp:31:11: error: expected unqualified-id before 'int' Complex(int pr, int pi) { ^ oop_numere_complexe.cpp:31:11: error: expected ')' before 'int' oop_numere_complexe.cpp:36:11: error: expected unqualified-id before ')' token Complex() { ^ oop_numere_complexe.cpp: In function 'void set(int, int)': oop_numere_complexe.cpp:42:5: error: 'r' was not declared in this scope r = pr; ^ oop_numere_complexe.cpp:43:5: error: 'i' was not declared in this scope i = pi; ^ oop_numere_complexe.cpp: In function 'double modul()': oop_numere_complexe.cpp:46:32: error: 'i' was not declared in this scope double modul() { return sqrt(i * i + r * r); } ^ oop_numere_complexe.cpp:46:40: error: 'r' was not declared in this scope double modul() { return sqrt(i * i + r * r); } ^ oop_numere_complexe.cpp: In function 'int real()': oop_numere_complexe.cpp:48:23: error: 'r' was not declared in this scope int real() { return r; }; ^ oop_numere_complexe.cpp: In function 'int imag()': oop_numere_complexe.cpp:50:23: error: 'i' was not declared in this scope int imag() { return i; }; ^ oop_numere_complexe.cpp: At global scope: oop_numere_complexe.cpp:52:3: error: 'friend' used outside of class friend ostream &operator<<(ostream &out, const Complex &c) { ^ oop_numere_complexe.cpp: In function 'Complex operator+(Complex)': oop_numere_complexe.cpp:7:12: error: 'int Complex::r' is private int i, r; ^ oop_numere_complexe.cpp:64:12: error: within this context result.r = r + other.r; ^ oop_numere_complexe.cpp:64:16: error: 'r' was not declared in this scope result.r = r + other.r; ^ oop_numere_complexe.cpp:7:12: error: 'int Complex::r' is private int i, r; ^ oop_numere_complexe.cpp:64:26: error: within this context result.r = r + other.r; ^ oop_numere_complexe.cpp:7:9: error: 'int Complex::i' is private int i, r; ^ oop_numere_complexe.cpp:65:12: error: within this context result.i = i + other.i; ^ oop_numere_complexe.cpp:65:16: error: 'i' was not declared in this scope result.i = i + other.i; ^ oop_numere_complexe.cpp:7:9: error: 'int Complex::i' is private int i, r; ^ oop_numere_complexe.cpp:65:26: error: within this context result.i = i + other.i; ^ oop_numere_complexe.cpp: In function 'Complex operator-(Complex)': oop_numere_complexe.cpp:7:12: error: 'int Complex::r' is private int i, r; ^ oop_numere_complexe.cpp:71:12: error: within this context result.r = r - other.r; ^ oop_numere_complexe.cpp:71:16: error: 'r' was not declared in this scope result.r = r - other.r; ^ oop_numere_complexe.cpp:7:12: error: 'int Complex::r' is private int i, r; ^ oop_numere_complexe.cpp:71:26: error: within this context result.r = r - other.r; ^ oop_numere_complexe.cpp:7:9: error: 'int Complex::i' is private int i, r; ^ oop_numere_complexe.cpp:72:12: error: within this context result.i = i - other.i; ^ oop_numere_complexe.cpp:72:16: error: 'i' was not declared in this scope result.i = i - other.i; ^ oop_numere_complexe.cpp:7:9: error: 'int Complex::i' is private int i, r; ^ oop_numere_complexe.cpp:72:26: error: within this context result.i = i - other.i; ^ oop_numere_complexe.cpp: In function 'Complex operator*(Complex)': oop_numere_complexe.cpp:7:12: error: 'int Complex::r' is private int i, r; ^ oop_numere_complexe.cpp:78:12: error: within this context result.r = r * other.r - i * other.i; ^ oop_numere_complexe.cpp:78:16: error: 'r' was not declared in this scope result.r = r * other.r - i * other.i; ^ oop_numere_complexe.cpp:7:12: error: 'int Complex::r' is private int i, r; ^ oop_numere_complexe.cpp:78:26: error: within this context result.r = r * other.r - i * other.i; ^ oop_numere_complexe.cpp:78:30: error: 'i' was not declared in this scope result.r = r * other.r - i * other.i; ^ oop_numere_complexe.cpp:7:9: error: 'int Complex::i' is private int i, r; ^ oop_numere_complexe.cpp:78:40: error: within this context result.r = r * other.r - i * other.i; ^ oop_numere_complexe.cpp:7:9: error: 'int Complex::i' is private int i, r; ^ oop_numere_complexe.cpp:79:12: error: within this context result.i = r * other.i + i * other.r; ^ oop_numere_complexe.cpp:7:9: error: 'int Complex::i' is private int i, r; ^ oop_numere_complexe.cpp:79:26: error: within this context result.i = r * other.i + i * other.r; ^ oop_numere_complexe.cpp:7:12: error: 'int Complex::r' is private int i, r; ^ oop_numere_complexe.cpp:79:40: error: within this context result.i = r * other.i + i * other.r; ^ oop_numere_complexe.cpp: At global scope: oop_numere_complexe.cpp:82:1: error: expected declaration before '}' token }; ^ oop_numere_complexe.cpp: In function 'double modul()': oop_numere_complexe.cpp:46:48: warning: control reaches end of non-void function [-Wreturn-type] double modul() { return sqrt(i * i + r * r); } ^ oop_numere_complexe.cpp: In function 'int real()': oop_numere_complexe.cpp:48:26: warning: control reaches end of non-void function [-Wreturn-type] int real() { return r; }; ^ oop_numere_complexe.cpp: In function 'int imag()': oop_numere_complexe.cpp:50:26: warning: control reaches end of non-void function [-Wreturn-type] int imag() { return i; }; ^
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ă.