#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 | #58249451 | Utilizator | |
Fișier | calculator.cpp | Dimensiune | 445 B |
Data încărcării | 22 Mai 2025, 11:30 | Scor / rezultat | Eroare de compilare |
calculator.cpp: In function 'int main()': calculator.cpp:14:25: error: no matching function for call to 'strchr(bool)' if(strchr(c=='+')) ^ calculator.cpp:14: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:17:25: error: no matching function for call to 'strchr(bool)' if(strchr(c=='*')) ^ calculator.cpp:17: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:20:25: error: no matching function for call to 'strchr(bool)' if(strchr(c=='-')) ^ calculator.cpp:20: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:23:25: error: no matching function for call to 'strchr(bool)' if(strchr(c=='/')) ^ calculator.cpp:23: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:8:15: warning: unused variable 'mini' [-Wunused-variable] int a, b, mini=1000, maxi=-1; ^ calculator.cpp:8:26: warning: unused variable 'maxi' [-Wunused-variable] int a, b, mini=1000, maxi=-1; ^
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ă.