#1
Să se scrie un program care citeşte din fişier două numere întregi şi determină suma lor.
| Problema | sum | Operații I/O |
sum.in/sum.out
|
|---|---|---|---|
| Limita timp | 1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #57786479 | Utilizator | |
| Fișier | sum.cpp | Dimensiune | 2.58 KB |
| Data încărcării | 16 Aprilie 2025, 11:01 | Scor/rezultat | Eroare de compilare |
sum.cpp: In function 'bool operator==(complexx, complexx)': sum.cpp:39:5: error: 're' was not declared in this scope if(re==z.re && im==z.im ) ^ sum.cpp:39:9: error: 'z' was not declared in this scope if(re==z.re && im==z.im ) ^ sum.cpp:39:17: error: 'im' was not declared in this scope if(re==z.re && im==z.im ) ^ sum.cpp: In function 'bool operator>(complexx, complexx)': sum.cpp:44:42: error: new declaration 'bool operator>(complexx, complexx)' bool operator>(complexx z1, complexx z2) ^ sum.cpp:34:21: error: ambiguates old declaration 'complexx operator>(complexx, complexx)' friend complexx operator > (complexx z1, complexx z2); ^ sum.cpp:7:19: error: 'float complexx::m' is private float re, im, m; ^ sum.cpp:46:8: error: within this context if(z1.m > z2.m) ^ sum.cpp:7:19: error: 'float complexx::m' is private float re, im, m; ^ sum.cpp:46:15: error: within this context if(z1.m > z2.m) ^ sum.cpp: In function 'int main()': sum.cpp:118:20: error: could not convert 'operator>(complexx, complexx)(complexx((* & v[j])))' from 'complexx' to 'bool' if(v[i]>v[j]) ^ In file included from /usr/include/c++/4.8/bits/stl_pair.h:59:0, from /usr/include/c++/4.8/bits/stl_algobase.h:64, from /usr/include/c++/4.8/bits/char_traits.h:39, from /usr/include/c++/4.8/ios:40, from /usr/include/c++/4.8/istream:38, from /usr/include/c++/4.8/sstream:38, from /usr/include/c++/4.8/complex:45, from /usr/include/c++/4.8/ccomplex:38, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:52, from sum.cpp:1: /usr/include/c++/4.8/bits/move.h: In instantiation of 'void std::swap(_Tp&, _Tp&) [with _Tp = complexx]': sum.cpp:119:31: required from here /usr/include/c++/4.8/bits/move.h:175:19: error: no matching function for call to 'complexx::complexx(std::remove_reference<complexx&>::type)' _Tp __tmp = _GLIBCXX_MOVE(__a); ^ /usr/include/c++/4.8/bits/move.h:175:19: note: candidates are: sum.cpp:19:5: note: complexx::complexx(complexx&) complexx (complexx & z) ^ sum.cpp:19:5: note: no known conversion for argument 1 from 'std::remove_reference<complexx&>::type {aka complexx}' to 'complexx&' sum.cpp:13:5: note: complexx::complexx(float, float) complexx (float x = 0, float y = 0) ^ sum.cpp:13:5: note: no known conversion for argument 1 from 'std::remove_reference<complexx&>::type {aka complexx}' to 'float'
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema sum face parte din prima categorie. 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ă.