#3079
numere_a_b
Se citesc două numere naturale a
şi b
, care au acelaşi număr de cifre. Scrieți un program pentru a construi şi afişa un număr natural c
cu proprietatea că fiecare cifră a acestuia este partea întreagă a mediei aritmetice a cifrelor situate in aceleaşi poziţii in numerele a
şi b
.
Problema | numere_a_b | Operații I/O | tastatură/ecran |
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #53593652 | Utilizator | |
Fișier | numere_a_b.cpp | Dimensiune | 463 B |
Data încărcării | 06 Noiembrie 2024, 00:21 | Scor / rezultat | Eroare de compilare |
numere_a_b.cpp: In function 'int main()': numere_a_b.cpp:6:11: error: ambiguous overload for 'operator>>' (operand types are 'std::basic_istream<char>::__istream_type {aka std::basic_istream<char>}' and 'char') cin>>a>>' '>>b; copa=a; copb=b; ^ numere_a_b.cpp:6:11: note: candidates are: In file included from /usr/include/c++/4.8/iostream:40:0, from numere_a_b.cpp:1: /usr/include/c++/4.8/istream:120:7: note: std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(std::basic_istream<_CharT, _Traits>::__istream_type& (*)(std::basic_istream<_CharT, _Traits>::__istream_type&)) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>] <near match> operator>>(__istream_type& (*__pf)(__istream_type&)) ^ /usr/include/c++/4.8/istream:120:7: note: no known conversion for argument 1 from 'char' to 'std::basic_istream<char>::__istream_type& (*)(std::basic_istream<char>::__istream_type&) {aka std::basic_istream<char>& (*)(std::basic_istream<char>&)}' /usr/include/c++/4.8/istream:124:7: note: std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(std::basic_istream<_CharT, _Traits>::__ios_type& (*)(std::basic_istream<_CharT, _Traits>::__ios_type&)) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>; std::basic_istream<_CharT, _Traits>::__ios_type = std::basic_ios<char>] <near match> operator>>(__ios_type& (*__pf)(__ios_type&)) ^ /usr/include/c++/4.8/istream:124:7: note: no known conversion for argument 1 from 'char' to 'std::basic_istream<char>::__ios_type& (*)(std::basic_istream<char>::__ios_type&) {aka std::basic_ios<char>& (*)(std::basic_ios<char>&)}' /usr/include/c++/4.8/istream:131:7: note: std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(std::ios_base& (*)(std::ios_base&)) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__istream_type = std::basic_istream<char>] <near match> operator>>(ios_base& (*__pf)(ios_base&)) ^ /usr/include/c++/4.8/istream:131:7: note: no known conversion for argument 1 from 'char' to 'std::ios_base& (*)(std::ios_base&)' /usr/include/c++/4.8/istream:259:7: note: std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(std::basic_istream<_CharT, _Traits>::__streambuf_type*) [with _CharT = char; _Traits = std::char_traits<char>; std::basic_istream<_CharT, _Traits>::__streambuf_type = std::basic_streambuf<char>] <near match> operator>>(__streambuf_type* __sb); ^ /usr/include/c++/4.8/istream:259:7: note: no known conversion for argument 1 from 'char' to 'std::basic_istream<char>::__streambuf_type* {aka std::basic_streambuf<char>*}'
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema numere_a_b 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ă.