#559
Se dau 5 numere distincte. Să se determine suma celor mai mari 3 dintre ele.
| Problema | 5numere | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64724087 | Utilizator | |
| Fișier | numere.cpp | Dimensiune | 459 B |
| Data încărcării | 26 Mai 2026, 10:04 | Scor/rezultat | Eroare de compilare |
numere.cpp: In function ‘int main()’: numere.cpp:6:5: error: no match for ‘operator<<’ (operand types are ‘std::istream’ {aka ‘std::basic_istream<char>’} and ‘int’) 6 | cin <<a, b, c, d, e; | ~~~ ^~~ | | | | | int | std::istream {aka std::basic_istream<char>} numere.cpp:6:5: note: candidate: ‘operator<<(int, int)’ (built-in) 6 | cin <<a, b, c, d, e; | ~~~~^~~ numere.cpp:6:5: note: no known conversion for argument 1 from ‘std::istream’ {aka ‘std::basic_istream<char>’} to ‘int’ In file included from /usr/include/c++/13/string:54, from /usr/include/c++/13/bits/locale_classes.h:40, from /usr/include/c++/13/bits/ios_base.h:41, from /usr/include/c++/13/ios:44, from /usr/include/c++/13/ostream:40, from /usr/include/c++/13/iostream:41, from numere.cpp:1: /usr/include/c++/13/bits/basic_string.h:4032:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const __cxx11::basic_string<_CharT, _Traits, _Alloc>&)’ 4032 | operator<<(basic_ostream<_CharT, _Traits>& __os, | ^~~~~~~~ /usr/include/c++/13/bits/basic_string.h:4032:5: note: template argument deduction/substitution failed: numere.cpp:6:7: note: ‘std::istream’ {aka ‘std::basic_istream<char>’} is not derived from ‘std::basic_ostream<_CharT, _Traits>’ 6 | cin <<a, b, c, d, e; | ^ In file included from /usr/include/c++/13/bits/ios_base.h:46: /usr/include/c++/13/system_error:339:5: note: candidate: ‘template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const error_code&)’ 339 | operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __e) | ^~~~~~~~ /usr/include/c++/13/system_error:339:5: note: template argument deduction/substitution failed: numere.cpp:6:7: note: ‘std::istream’ {aka ‘std::basic_istream<char>’} is not derived from ‘std::basic_ostream<_CharT, _Traits>’ 6 | cin <<a, b, c, d, e; | ^ /usr/include/c++/13/ostream:554:5: note: candidate: ‘template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, _CharT)’ 554 | operator<<(basic_ostream<_CharT, _Traits>& __out, _CharT __c) | ^~~~~~~~ /usr/include/c++/13/ostream:554:5: note: template argument deduction/substitution failed: numere.cpp:6:7: note: ‘std::istream’ {aka ‘std::basic_istream<char>’} is not derived from ‘std::basic_ostream<_CharT, _Traits>’ 6 | cin <<a, b, c, d, e; | ^ /usr/include/c++/13/ostream:564:5: note: candidate: ‘template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, char)’ 564 | operator<<(basic_ostream<_CharT, _Traits>& __out, char __c) | ^~~~~~~~ /usr/include/c++/13/ostream:564:5: note: template argument deduction/substitution failed: numere.cpp:6:7: note: ‘std::istream’ {aka ‘std::basic_istream<char>’} is not derived from ‘std::basic_ostream<_CharT, _Traits>’ 6 | cin <<a, b, c, d, e; | ^ /usr/include/c++/13/ostream:570:5: note: candidate: ‘template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, char)’ 570 | operator<<(basic_ostream<char, _Traits>& __out, char __c) | ^~~~~~~~ /usr/include/c++/13/ostream:570:5: note: template argument deduction/substitution failed: numere.cpp:6:7: note: ‘std::istream’ {aka ‘std::basic_istream<char>’} is not derived from ‘std::basic_ostream<char, _Traits>’ 6 | cin <<a, b, c, d, e; | ^ /usr/include/c++/13/ostream:581:5: note: candidate: ‘template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, signed char)’ 581 | operator<<(basic_ostream<char, _Traits>& __out, signed char __c) | ^~~~~~~~ /usr/include/c++/13/ostream:581:5: note: template argument deduction/substitution failed: numere.cpp:6:7: note: ‘std::istream’ {aka ‘std::basic_istream<char>’} is not derived from ‘std::basic_ostream<char, _Traits>’ 6 | cin <<a, b, c, d, e; | ^ /usr/include/c++/13/ostream:586:5: note: candidate: ‘template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, unsigned char)’ 586 | operator<<(basic_ostream<char, _Traits>& __out, unsigned char __c) | ^~~~~~~~ /usr/include/c++/13/ostream:586:5: note: template argument deduction/substitution failed: numere.cpp:6:7: note: ‘std::istream’ {aka ‘std::basic_istream<char>’} is not derived from ‘std::basic_ostream<char, _Traits>’ 6 | cin <<a, b, c, d, e; | ^ /usr/include/c++/13/ostream:645:5: note: candidate: ‘template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const _CharT*)’ 645 | operator<<(basic_ostream<_CharT, _Traits>& __out, const _CharT* __s) | ^~~~~~~~ /usr/include/c++/13/ostream:645:5: note: template argument deduction/substitution failed: numere.cpp:6:7: note: ‘std::istream’ {aka ‘std::basic_istream<char>’} is not derived from ‘std::basic_ostream<_CharT, _Traits>’ 6 | cin <<a, b, c, d, e; | ^ In file included from /usr/include/c++/13/ostream:880: /usr/include/c++/13/bits/ostream.tcc:307:5: note: candidate: ‘template<class _CharT, class _Traits> std::basic_ostream<_CharT, _Traits>& std::operator<<(basic_ostream<_CharT, _Traits>&, const char*)’ 307 | operator<<(basic_ostream<_CharT, _Traits>& __out, const char* __s) | ^~~~~~~~ /usr/include/c++/13/bits/ostream.tcc:307:5: note: template argument deduction/substitution failed: numere.cpp:6:7: note: ‘std::istream’ {aka ‘std::basic_istream<char>’} is not derived from ‘std::basic_ostream<_CharT, _Traits>’ 6 | cin <<a, b, c, d, e; | ^ /usr/include/c++/13/ostream:662:5: note: candidate: ‘template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const char*)’ 662 | operator<<(basic_ostream<char, _Traits>& __out, const char* __s) | ^~~~~~~~ /usr/include/c++/13/ostream:662:5: note: template argument deduction/substitution failed: numere.cpp:6:7: note: ‘std::istream’ {aka ‘std::basic_istream<char>’} is not derived from ‘std::basic_ostream<char, _Traits>’ 6 | cin <<a, b, c, d, e; | ^ /usr/include/c++/13/ostream:675:5: note: candidate: ‘template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const signed char*)’ 675 | operator<<(basic_ostream<char, _Traits>& __out, const signed char* __s) | ^~~~~~~~ /usr/include/c++/13/ostream:675:5: note: template argument deduction/substitution failed: numere.cpp:6:7: note: ‘std::istream’ {aka ‘std::basic_istream<char>’} is not derived from ‘std::basic_ostream<char, _Traits>’ 6 | cin <<a, b, c, d, e; | ^ /usr/include/c++/13/ostream:680:5: note: candidate: ‘template<class _Traits> std::basic_ostream<char, _Traits>& std::operator<<(basic_ostream<char, _Traits>&, const unsigned char*)’ 680 | operator<<(basic_ostream<char, _Traits>& __out, const unsigned char* __s) | ^~~~~~~~ /usr/include/c++/13/ostream:680:5: note: template argument deduction/substitution failed: numere.cpp:6:7: note: ‘std::istream’ {aka ‘std::basic_istream<char>’} is not derived from ‘std::basic_ostream<char, _Traits>’ 6 | cin <<a, b, c, d, e; | ^ /usr/include/c++/13/ostream:801:5: note: candidate: ‘template<class _Ostream, class _Tp> _Ostream&& std::operator<<(_Ostream&&, const _Tp&)’ 801 | operator<<(_Ostream&& __os, const _Tp& __x) | ^~~~~~~~ /usr/include/c++/13/ostream:801:5: note: template argument deduction/substitution failed: /usr/include/c++/13/ostream: In substitution of ‘template<class _Ostream, class _Tp> _Ostream&& std::operator<<(_Ostream&&, const _Tp&) [with _Ostream = std::basic_istream<char>&; _Tp = int]’: numere.cpp:6:7: required from here /usr/include/c++/13/ostream:801:5: error: no type named ‘type’ in ‘struct std::enable_if<false, void>’ numere.cpp:7:12: error: expected ‘;’ before ‘if’ 7 | s=a+b+c+d+e | ^ | ; 8 | if (a<=b && a<=c && a<=d && a<=e) | ~~ numere.cpp:11:1: error: ‘else’ without a previous ‘if’ 11 | else if (b<=a b<=c b<=d b<=e) | ^~~~ numere.cpp:11:14: error: expected ‘)’ before ‘b’ 11 | else if (b<=a b<=c b<=d b<=e) | ~ ^~ | ) numere.cpp:12:2: error: ‘m’ was not declared in this scope 12 | {m=b; | ^ numere.cpp:14:14: error: expected ‘)’ before ‘c’ 14 | else if (c<=a c<=b c<=d c<=e) | ~ ^~ | ) numere.cpp:15:2: error: ‘m’ was not declared in this scope 15 | {m=c; | ^ numere.cpp:17:14: error: expected ‘)’ before ‘d’ 17 | else if (d<=a d<=b d<=c d<=e) | ~ ^~ | ) numere.cpp:18:2: error: ‘m’ was not declared in this scope 18 | {m=d | ^ numere.cpp:20:14: error: expected ‘)’ before ‘e’ 20 | else if (e<=a e<=b e<=c e<=d) | ~ ^~ | ) numere.cpp:21:2: error: ‘m’ was not declared in this scope 21 | {m=e | ^ numere.cpp:23:5: error: ‘m’ was not declared in this scope 23 | s=s-m | ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema 5numere 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ă.