#1270
Se dă un număr natural în baza 16. Să se transforme acest număr în baza 10.
| Problema | b16 | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64052419 | Utilizator | |
| Fișier | b16.cpp | Dimensiune | 383 B |
| Data încărcării | 14 Aprilie 2026, 11:46 | Scor/rezultat | Eroare de compilare |
b16.cpp: In function 'int main()': b16.cpp:6:12: error: cannot bind 'std::istream {aka std::basic_istream<char>}' lvalue to 'std::basic_istream<char>&&' cin >> s; ^ In file included from /usr/include/c++/4.8/sstream:38:0, from /usr/include/c++/4.8/complex:45, from /usr/include/c++/4.8/ccomplex:38, from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:52, from b16.cpp:1: /usr/include/c++/4.8/istream:872:5: error: initializing argument 1 of 'std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&&, _Tp&) [with _CharT = char; _Traits = std::char_traits<char>; _Tp = std::basic_string<char> [100]]' operator>>(basic_istream<_CharT, _Traits>&& __is, _Tp& __x) ^ b16.cpp:7:36: error: cannot convert 'std::string* {aka std::basic_string<char>*}' to 'const char*' for argument '1' to 'size_t strlen(const char*)' for (string i = 0; i < strlen(s); i++) { ^ b16.cpp:7:40: error: no 'operator++(int)' declared for postfix '++' [-fpermissive] for (string i = 0; i < strlen(s); i++) { ^ b16.cpp:8:15: error: no match for 'operator[]' (operand types are 'std::string [100] {aka std::basic_string<char> [100]}' and 'std::string {aka std::basic_string<char>}') if ((s[i] >= '0') && (s[i] <= '9')) ^ b16.cpp:8:32: error: no match for 'operator[]' (operand types are 'std::string [100] {aka std::basic_string<char> [100]}' and 'std::string {aka std::basic_string<char>}') if ((s[i] >= '0') && (s[i] <= '9')) ^ b16.cpp:9:20: error: no match for 'operator[]' (operand types are 'std::string [100] {aka std::basic_string<char> [100]}' and 'std::string {aka std::basic_string<char>}') val = s[i] - '0'; ^ b16.cpp:10:15: error: no match for 'operator[]' (operand types are 'std::string [100] {aka std::basic_string<char> [100]}' and 'std::string {aka std::basic_string<char>}') if ((s[i] >= 'A') && (s[i] <= 'F')) ^ b16.cpp:10:32: error: no match for 'operator[]' (operand types are 'std::string [100] {aka std::basic_string<char> [100]}' and 'std::string {aka std::basic_string<char>}') if ((s[i] >= 'A') && (s[i] <= 'F')) ^ b16.cpp:11:25: error: no match for 'operator[]' (operand types are 'std::string [100] {aka std::basic_string<char> [100]}' and 'std::string {aka std::basic_string<char>}') val = 10 + s[i]-'A'; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema b16 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ă.