#3539
oop_numere_complexe
C++
Ai primit definiția unei clase. Implementează toate metodele clasei.
Problema | oop_numere_complexe | Operații I/O |
![]() |
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #23083994 | Utilizator | |
Fișier | oop_numere_complexe.cpp | Dimensiune | 1.33 KB |
Data încărcării | 22 Mai 2020, 10:21 | Scor / rezultat | Eroare de compilare |
oop_numere_complexe.cpp:34:7: error: redefinition of 'class Complex' class Complex ^ oop_numere_complexe.cpp:4:7: error: previous definition of 'class Complex' class Complex ^ oop_numere_complexe.cpp: In function 'std::ostream& operator<<(std::ostream&, const Complex&)': oop_numere_complexe.cpp:77: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:77: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:77:29: error: 'out' was not declared in this scope if(x.real!=0||x.imag==0)out <<x.real; ^ oop_numere_complexe.cpp:78:15: error: invalid use of member function (did you forget the '()' ?) if(x.imag>0&&x.real!=0)out<<"+"; ^ oop_numere_complexe.cpp:78:26: error: invalid use of member function (did you forget the '()' ?) if(x.imag>0&&x.real!=0)out<<"+"; ^ oop_numere_complexe.cpp:78:28: error: 'out' was not declared in this scope if(x.imag>0&&x.real!=0)out<<"+"; ^ oop_numere_complexe.cpp:79:16: error: invalid use of member function (did you forget the '()' ?) if(x.imag!=0)out<<x.imag<<"i"; ^ oop_numere_complexe.cpp:79:18: error: 'out' was not declared in this scope if(x.imag!=0)out<<x.imag<<"i"; ^ oop_numere_complexe.cpp:80:12: error: 'out' was not declared in this scope return out; ^ oop_numere_complexe.cpp: In function 'int main()': oop_numere_complexe.cpp:105:5: error: redefinition of 'int main()' int main() ^ oop_numere_complexe.cpp:100:5: error: 'int main()' previously defined here int main() ^ oop_numere_complexe.cpp:111: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:111:31: note: candidates are: oop_numere_complexe.cpp:28:13: note: Complex Complex::operator*(Complex) Complex operator *(Complex ); ^ oop_numere_complexe.cpp:94:9: note: Complex operator*(Complex, Complex) Complex operator*(Complex a, Complex b) ^ oop_numere_complexe.cpp:111: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:111:45: note: candidates are: oop_numere_complexe.cpp:24:13: note: Complex Complex::operator+(Complex) Complex operator +(Complex ); ^ oop_numere_complexe.cpp:82:9: note: Complex operator+(Complex, Complex) Complex operator+(Complex a, Complex b) ^ oop_numere_complexe.cpp:111: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:111:59: note: candidates are: oop_numere_complexe.cpp:26:13: note: Complex Complex::operator-(Complex) Complex operator -(Complex ); ^ oop_numere_complexe.cpp:88: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:81: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ă.