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 215 views
1 answer 224 views
3 answers 200 views
200 views asked Aug 24, 2021 by avibootz
1 answer 142 views
142 views asked Aug 24, 2021 by avibootz
1 answer 163 views
1 answer 94 views
...