#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 |
![]() |
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #58242600 | Utilizator | |
Fișier | calculator.cpp | Dimensiune | 574 B |
Data încărcării | 21 Mai 2025, 22:43 | Scor / rezultat | Eroare de compilare |
calculator.cpp: In function 'int main()': calculator.cpp:23:21: error: no matching function for call to 'strchr(bool)' if(strchr(c=='+')) ^ calculator.cpp:23:21: note: candidates are: In file included from /usr/include/c++/4.8/cstring:42:0, from calculator.cpp:3: /usr/include/string.h:223:1: note: char* strchr(char*, int) strchr (char *__s, int __c) __THROW ^ /usr/include/string.h:223:1: note: candidate expects 2 arguments, 1 provided /usr/include/string.h:229:1: note: const char* strchr(const char*, int) strchr (const char *__s, int __c) __THROW ^ /usr/include/string.h:229:1: note: candidate expects 2 arguments, 1 provided calculator.cpp:26:25: error: no matching function for call to 'strchr(bool)' if(strchr(c=='*')) ^ calculator.cpp:26:25: note: candidates are: In file included from /usr/include/c++/4.8/cstring:42:0, from calculator.cpp:3: /usr/include/string.h:223:1: note: char* strchr(char*, int) strchr (char *__s, int __c) __THROW ^ /usr/include/string.h:223:1: note: candidate expects 2 arguments, 1 provided /usr/include/string.h:229:1: note: const char* strchr(const char*, int) strchr (const char *__s, int __c) __THROW ^ /usr/include/string.h:229:1: note: candidate expects 2 arguments, 1 provided calculator.cpp:29:25: error: no matching function for call to 'strchr(bool)' if(strchr(c=='-')) ^ calculator.cpp:29:25: note: candidates are: In file included from /usr/include/c++/4.8/cstring:42:0, from calculator.cpp:3: /usr/include/string.h:223:1: note: char* strchr(char*, int) strchr (char *__s, int __c) __THROW ^ /usr/include/string.h:223:1: note: candidate expects 2 arguments, 1 provided /usr/include/string.h:229:1: note: const char* strchr(const char*, int) strchr (const char *__s, int __c) __THROW ^ /usr/include/string.h:229:1: note: candidate expects 2 arguments, 1 provided calculator.cpp:32:25: error: no matching function for call to 'strchr(bool)' if(strchr(c=='/')) ^ calculator.cpp:32:25: note: candidates are: In file included from /usr/include/c++/4.8/cstring:42:0, from calculator.cpp:3: /usr/include/string.h:223:1: note: char* strchr(char*, int) strchr (char *__s, int __c) __THROW ^ /usr/include/string.h:223:1: note: candidate expects 2 arguments, 1 provided /usr/include/string.h:229:1: note: const char* strchr(const char*, int) strchr (const char *__s, int __c) __THROW ^ /usr/include/string.h:229:1: note: candidate expects 2 arguments, 1 provided
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ă.