#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 |
![]() |
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 64 MB
|
Id soluție | #56756725 | Utilizator | |
Fișier | b16rec.cpp | Dimensiune | 474 B |
Data încărcării | 04 Martie 2025, 21:10 | Scor / rezultat | Eroare de compilare |
b16rec.cpp: In function 'long long int conversie(int)': b16rec.cpp:11:9: error: reference to 'hex' is ambiguous if (hex[poz] >= '0' && hex[poz] <= '9') ^ b16rec.cpp:6:6: note: candidates are: char hex [19] char hex[19]; ^ In file included from /usr/include/c++/4.8/ios:42:0, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from b16rec.cpp:1: /usr/include/c++/4.8/bits/ios_base.h:947:3: note: std::ios_base& std::hex(std::ios_base&) hex(ios_base& __base) ^ b16rec.cpp:11:28: error: reference to 'hex' is ambiguous if (hex[poz] >= '0' && hex[poz] <= '9') ^ b16rec.cpp:6:6: note: candidates are: char hex [19] char hex[19]; ^ In file included from /usr/include/c++/4.8/ios:42:0, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from b16rec.cpp:1: /usr/include/c++/4.8/bits/ios_base.h:947:3: note: std::ios_base& std::hex(std::ios_base&) hex(ios_base& __base) ^ b16rec.cpp:12:19: error: reference to 'hex' is ambiguous valoare = hex[poz] - '0'; ^ b16rec.cpp:6:6: note: candidates are: char hex [19] char hex[19]; ^ In file included from /usr/include/c++/4.8/ios:42:0, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from b16rec.cpp:1: /usr/include/c++/4.8/bits/ios_base.h:947:3: note: std::ios_base& std::hex(std::ios_base&) hex(ios_base& __base) ^ b16rec.cpp:14:19: error: reference to 'hex' is ambiguous valoare = hex[poz] - 'A' + 10; ^ b16rec.cpp:6:6: note: candidates are: char hex [19] char hex[19]; ^ In file included from /usr/include/c++/4.8/ios:42:0, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from b16rec.cpp:1: /usr/include/c++/4.8/bits/ios_base.h:947:3: note: std::ios_base& std::hex(std::ios_base&) hex(ios_base& __base) ^ b16rec.cpp: In function 'int main()': b16rec.cpp:20:12: error: reference to 'hex' is ambiguous cin >> hex; ^ b16rec.cpp:6:6: note: candidates are: char hex [19] char hex[19]; ^ In file included from /usr/include/c++/4.8/ios:42:0, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from b16rec.cpp:1: /usr/include/c++/4.8/bits/ios_base.h:947:3: note: std::ios_base& std::hex(std::ios_base&) hex(ios_base& __base) ^ b16rec.cpp:21:26: error: reference to 'hex' is ambiguous int lungime = strlen(hex); ^ b16rec.cpp:6:6: note: candidates are: char hex [19] char hex[19]; ^ In file included from /usr/include/c++/4.8/ios:42:0, from /usr/include/c++/4.8/ostream:38, from /usr/include/c++/4.8/iostream:39, from b16rec.cpp:1: /usr/include/c++/4.8/bits/ios_base.h:947:3: note: std::ios_base& std::hex(std::ios_base&) hex(ios_base& __base) ^
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ă.