#3539
oop_numere_complexe
C++
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 | #53511161 | Utilizator | |
Fișier | oop_numere_complexe.cpp | Dimensiune | 1.56 KB |
Data încărcării | 03 Noiembrie 2024, 19:21 | Scor / rezultat | Eroare de compilare |
oop_numere_complexe.cpp:33:13: error: expected unqualified-id before 'int' Complex(int pr, int pi) : r(pr), i(pi) {} ^ oop_numere_complexe.cpp:33:13: error: expected ')' before 'int' oop_numere_complexe.cpp:36:13: error: expected unqualified-id before ')' token Complex() : r(0), i(0) {} ^ oop_numere_complexe.cpp: In function 'void set(int, int)': oop_numere_complexe.cpp:40:9: error: 'r' was not declared in this scope r = pr; ^ oop_numere_complexe.cpp:41:9: error: 'i' was not declared in this scope i = pi; ^ oop_numere_complexe.cpp: At global scope: oop_numere_complexe.cpp:45:20: error: non-member function 'double modul()' cannot have cv-qualifier double modul() const { ^ oop_numere_complexe.cpp: In function 'double modul()': oop_numere_complexe.cpp:46:21: error: 'r' was not declared in this scope return sqrt(r * r + i * i); ^ oop_numere_complexe.cpp:46:29: error: 'i' was not declared in this scope return sqrt(r * r + i * i); ^ oop_numere_complexe.cpp: At global scope: oop_numere_complexe.cpp:50:16: error: non-member function 'int real()' cannot have cv-qualifier int real() const { ^ oop_numere_complexe.cpp: In function 'int real()': oop_numere_complexe.cpp:51:16: error: 'r' was not declared in this scope return r; ^ oop_numere_complexe.cpp: At global scope: oop_numere_complexe.cpp:55:16: error: non-member function 'int imag()' cannot have cv-qualifier int imag() const { ^ oop_numere_complexe.cpp: In function 'int imag()': oop_numere_complexe.cpp:56:16: error: 'i' was not declared in this scope return i; ^ oop_numere_complexe.cpp: At global scope: oop_numere_complexe.cpp:60:5: error: 'friend' used outside of class friend ostream& operator<<(ostream& os, const Complex& c) { ^ oop_numere_complexe.cpp:66:39: error: non-member function 'Complex operator+(Complex)' cannot have cv-qualifier Complex operator +(Complex other) const { ^ oop_numere_complexe.cpp: In function 'Complex operator+(Complex)': oop_numere_complexe.cpp:67:24: error: 'r' was not declared in this scope return Complex(r + other.r, i + other.i); ^ oop_numere_complexe.cpp:67:37: error: 'i' was not declared in this scope return Complex(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:67:34: error: within this context return Complex(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:67:47: error: within this context return Complex(r + other.r, i + other.i); ^ oop_numere_complexe.cpp: At global scope: oop_numere_complexe.cpp:71:39: error: non-member function 'Complex operator-(Complex)' cannot have cv-qualifier Complex operator -(Complex other) const { ^ oop_numere_complexe.cpp: In function 'Complex operator-(Complex)': oop_numere_complexe.cpp:72:24: error: 'r' was not declared in this scope return Complex(r - other.r, i - other.i); ^ oop_numere_complexe.cpp:72:37: error: 'i' was not declared in this scope return Complex(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:72:34: error: within this context return Complex(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:72:47: error: within this context return Complex(r - other.r, i - other.i); ^ oop_numere_complexe.cpp: At global scope: oop_numere_complexe.cpp:76:39: error: non-member function 'Complex operator*(Complex)' cannot have cv-qualifier Complex operator *(Complex other) const { ^ oop_numere_complexe.cpp: In function 'Complex operator*(Complex)': oop_numere_complexe.cpp:77:24: error: 'r' was not declared in this scope int realPart = 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:77:34: error: within this context int realPart = r * other.r - i * other.i; ^ oop_numere_complexe.cpp:77:38: error: 'i' was not declared in this scope int realPart = 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:77:48: error: within this context int realPart = 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:34: error: within this context int imagPart = 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:78:48: error: within this context int imagPart = r * other.i + i * other.r; ^ oop_numere_complexe.cpp: In function 'double modul()': oop_numere_complexe.cpp:47:5: warning: control reaches end of non-void function [-Wreturn-type] } ^ oop_numere_complexe.cpp: In function 'int real()': oop_numere_complexe.cpp:52:5: warning: control reaches end of non-void function [-Wreturn-type] } ^ oop_numere_complexe.cpp: In function 'int imag()': oop_numere_complexe.cpp:57:5: warning: control reaches end of non-void function [-Wreturn-type] } ^ oop_numere_complexe.cpp: In function 'Complex operator+(Complex)': oop_numere_complexe.cpp:68:5: warning: control reaches end of non-void function [-Wreturn-type] } ^ oop_numere_complexe.cpp: In function 'Complex operator-(Complex)': oop_numere_complexe.cpp:73:5: warning: control reaches end of non-void function [-Wreturn-type] } ^
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ă.