#1303
Calculator
Se dau două numere naturale și un simbol pentru una dintre operațiile +
, -
, *
, /
. Să se determine rezultatul operației aplicate pentru cele două numere.
Problema | Calculator | Operații I/O | tastatură/ecran |
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #55070108 | Utilizator | |
Fișier | calculator.cpp | Dimensiune | 322 B |
Data încărcării | 20 Decembrie 2024, 12:12 | Scor / rezultat | Eroare de compilare |
calculator.cpp: In function 'int main()': calculator.cpp:11:24: error: no match for 'operator=' (operand types are 'std::basic_ostream<char>' and 'int') case '+': cout<<R=A+B; break; ^ calculator.cpp:11:24: note: candidate is: In file included from /usr/include/c++/4.8/iostream:39:0, from calculator.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>&' calculator.cpp:12:24: error: no match for 'operator=' (operand types are 'std::basic_ostream<char>' and 'int') case '-': cout<<R=A-B; break; ^ calculator.cpp:12:24: note: candidate is: In file included from /usr/include/c++/4.8/iostream:39:0, from calculator.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>&' calculator.cpp:13:24: error: no match for 'operator=' (operand types are 'std::basic_ostream<char>' and 'int') case '*': cout<<R=A*B; break; ^ calculator.cpp:13:24: note: candidate is: In file included from /usr/include/c++/4.8/iostream:39:0, from calculator.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>&' calculator.cpp:14:24: error: no match for 'operator=' (operand types are 'std::basic_ostream<char>' and 'int') case '/': cout<<R=A/B; break; ^ calculator.cpp:14:24: note: candidate is: In file included from /usr/include/c++/4.8/iostream:39:0, from calculator.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>&'
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Calculator 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ă.