How to convert hexadecimal to decimal in C++

1 Answer

0 votes
#include <iostream>
#include <iomanip>
#include <sstream>

int main()
{
    std::string hex = "FD";
    int decimal;
    
    std::stringstream stream;

    stream << hex;
    stream >> std::hex >> decimal;
    
    std::cout << decimal;

    return 0;
}




 
/*
run:
 
253
 
*/

 



answered Aug 24, 2021 by avibootz

Related questions

1 answer 185 views
1 answer 208 views
3 answers 177 views
177 views asked Aug 24, 2021 by avibootz
1 answer 123 views
123 views asked Aug 24, 2021 by avibootz
1 answer 143 views
1 answer 81 views
...