#3095
Se dă un număr n în baza 16. Să se transforme acest număr în baza 10, folosind un subprogram recursiv.
| Problema | b16rec | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 64 MB
|
| Id soluție | #64798135 | Utilizator | |
| Fișier | b16rec.cpp | Dimensiune | 255 B |
| Data încărcării | 02 Iunie 2026, 09:16 | Scor/rezultat | Eroare de compilare |
b16rec.cpp: In function ‘long long int f(char*, long long int)’: b16rec.cpp:2:8: error: ‘strlen’ was not declared in this scope 2 | {int n=strlen(s); | ^~~~~~ b16rec.cpp:1:1: note: ‘strlen’ is defined in header ‘<cstring>’; did you forget to ‘#include <cstring>’? +++ |+#include <cstring> 1 | long long f(char s[],long long p) b16rec.cpp:11:22: error: expected ‘;’ before ‘}’ token 11 | return c*p+f(s,p*16) | ^ | ; 12 | } | ~ b16rec.cpp:13:9: warning: empty parentheses were disambiguated as a function declaration [-Wvexing-parse] 13 | int main() | ^~ b16rec.cpp:13:9: note: remove parentheses to default-initialize a variable 13 | int main() | ^~ | -- b16rec.cpp:13:9: note: or replace parentheses with braces to value-initialize a variable b16rec.cpp:14:1: error: a function-definition is not allowed here before ‘{’ token 14 | {char s[1000]; | ^ b16rec.cpp:17:2: error: expected ‘}’ at end of input 17 | } | ^ b16rec.cpp:2:1: note: to match this ‘{’ 2 | {int n=strlen(s); | ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema b16rec 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ă.