#169
sumcif
Să se scrie un program care citeşte de la tastatură un număr natural cu exact trei cifre și determină suma cifrelor sale.
Problema | sumcif | Operații I/O | tastatură/ecran |
---|---|---|---|
Limita timp | 1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #54178951 | Utilizator | |
Fișier | sumcif.cpp | Dimensiune | 328 B |
Data încărcării | 21 Noiembrie 2024, 13:30 | Scor / rezultat | Eroare de compilare |
sumcif.cpp: In function 'int main()': sumcif.cpp:12:15: error: no match for 'operator=' (operand types are 'std::basic_istream<char>::__istream_type {aka std::basic_istream<char>}' and 'int') cin>> cf1 =(nr1%10); ^ sumcif.cpp:12:15: note: candidate is: In file included from /usr/include/c++/4.8/iostream:40:0, from sumcif.cpp:1: /usr/include/c++/4.8/istream:58:11: note: std::basic_istream<char>& std::basic_istream<char>::operator=(const std::basic_istream<char>&) <deleted> class basic_istream : virtual public basic_ios<_CharT, _Traits> ^ /usr/include/c++/4.8/istream:58:11: note: no known conversion for argument 1 from 'int' to 'const std::basic_istream<char>&' sumcif.cpp:13:15: error: no match for 'operator=' (operand types are 'std::basic_istream<char>::__istream_type {aka std::basic_istream<char>}' and 'int') cin>> cf2 =(nr1%100); ^ sumcif.cpp:13:15: note: candidate is: In file included from /usr/include/c++/4.8/iostream:40:0, from sumcif.cpp:1: /usr/include/c++/4.8/istream:58:11: note: std::basic_istream<char>& std::basic_istream<char>::operator=(const std::basic_istream<char>&) <deleted> class basic_istream : virtual public basic_ios<_CharT, _Traits> ^ /usr/include/c++/4.8/istream:58:11: note: no known conversion for argument 1 from 'int' to 'const std::basic_istream<char>&' sumcif.cpp:14:15: error: no match for 'operator=' (operand types are 'std::basic_istream<char>::__istream_type {aka std::basic_istream<char>}' and 'int') cin>> cf3 =(nr1%1000); ^ sumcif.cpp:14:15: note: candidate is: In file included from /usr/include/c++/4.8/iostream:40:0, from sumcif.cpp:1: /usr/include/c++/4.8/istream:58:11: note: std::basic_istream<char>& std::basic_istream<char>::operator=(const std::basic_istream<char>&) <deleted> class basic_istream : virtual public basic_ios<_CharT, _Traits> ^ /usr/include/c++/4.8/istream:58:11: note: no known conversion for argument 1 from 'int' to 'const std::basic_istream<char>&' sumcif.cpp:16:16: error: no match for 'operator=' (operand types are 'std::basic_ostream<char>' and 'int') cout<< suma=cf1+cf2+cf3; endl; ^ sumcif.cpp:16:16: note: candidate is: In file included from /usr/include/c++/4.8/iostream:39:0, from sumcif.cpp:1: /usr/include/c++/4.8/ostream:58:11: note: std::basic_ostream<char>& std::basic_ostream<char>::operator=(const std::basic_ostream<char>&) <deleted> class basic_ostream : virtual public basic_ios<_CharT, _Traits> ^ /usr/include/c++/4.8/ostream:58:11: note: no known conversion for argument 1 from 'int' to 'const std::basic_ostream<char>&' sumcif.cpp:16:34: error: statement cannot resolve address of overloaded function cout<< suma=cf1+cf2+cf3; endl; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema sumcif 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ă.