#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 | #23084012 | Utilizator | |
Fișier | oop_numere_complexe.cpp | Dimensiune | 929 B |
Data încărcării | 22 Mai 2020, 10:22 | Scor / rezultat | Eroare de compilare |
oop_numere_complexe.cpp: In function 'std::ostream& operator<<(std::ostream&, const Complex&)': oop_numere_complexe.cpp:59:16: error: invalid use of member function (did you forget the '()' ?) if(x.real!=0||x.imag==0)out <<x.real; ^ oop_numere_complexe.cpp:59:27: error: invalid use of member function (did you forget the '()' ?) if(x.real!=0||x.imag==0)out <<x.real; ^ oop_numere_complexe.cpp:59:29: error: 'out' was not declared in this scope if(x.real!=0||x.imag==0)out <<x.real; ^ oop_numere_complexe.cpp:60:15: error: invalid use of member function (did you forget the '()' ?) if(x.imag>0&&x.real!=0)out<<"+"; ^ oop_numere_complexe.cpp:60:26: error: invalid use of member function (did you forget the '()' ?) if(x.imag>0&&x.real!=0)out<<"+"; ^ oop_numere_complexe.cpp:60:28: error: 'out' was not declared in this scope if(x.imag>0&&x.real!=0)out<<"+"; ^ oop_numere_complexe.cpp:61:16: error: invalid use of member function (did you forget the '()' ?) if(x.imag!=0)out<<x.imag<<"i"; ^ oop_numere_complexe.cpp:61:18: error: 'out' was not declared in this scope if(x.imag!=0)out<<x.imag<<"i"; ^ oop_numere_complexe.cpp:62:12: error: 'out' was not declared in this scope return out; ^ oop_numere_complexe.cpp: In function 'int main()': oop_numere_complexe.cpp:89:31: error: ambiguous overload for 'operator*' (operand types are 'Complex' and 'Complex') cout << a.modul()<<" "<< a*b << " " << a+b << " " << a-b; ^ oop_numere_complexe.cpp:89:31: note: candidates are: oop_numere_complexe.cpp:28:13: note: Complex Complex::operator*(Complex) Complex operator *(Complex ); ^ oop_numere_complexe.cpp:76:9: note: Complex operator*(Complex, Complex) Complex operator*(Complex a, Complex b) ^ oop_numere_complexe.cpp:89:45: error: ambiguous overload for 'operator+' (operand types are 'Complex' and 'Complex') cout << a.modul()<<" "<< a*b << " " << a+b << " " << a-b; ^ oop_numere_complexe.cpp:89:45: note: candidates are: oop_numere_complexe.cpp:24:13: note: Complex Complex::operator+(Complex) Complex operator +(Complex ); ^ oop_numere_complexe.cpp:64:9: note: Complex operator+(Complex, Complex) Complex operator+(Complex a, Complex b) ^ oop_numere_complexe.cpp:89:59: error: ambiguous overload for 'operator-' (operand types are 'Complex' and 'Complex') cout << a.modul()<<" "<< a*b << " " << a+b << " " << a-b; ^ oop_numere_complexe.cpp:89:59: note: candidates are: oop_numere_complexe.cpp:26:13: note: Complex Complex::operator-(Complex) Complex operator -(Complex ); ^ oop_numere_complexe.cpp:70:9: note: Complex operator-(Complex, Complex) Complex operator-(Complex a, Complex b) ^ oop_numere_complexe.cpp: In function 'std::ostream& operator<<(std::ostream&, const Complex&)': oop_numere_complexe.cpp:63:1: 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ă.