fork(302) download
  1. #include <iostream>
  2. #include <string>
  3.  
  4. int main()
  5. {
  6. std::string s = "5f0066";
  7. int num = std::stoi(s, 0, 16);
  8.  
  9. std::cout << "value in decimal = " << num << '\n';
  10. std::cout << "value in hexadecimal = " << std::hex << num << '\n';
  11. }
Success #stdin #stdout 0s 3060KB
stdin
Standard input is empty
stdout
value in decimal     = 6226022
value in hexadecimal = 5f0066