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 199 views
199 views asked Aug 24, 2021 by avibootz
1 answer 141 views
141 views asked Aug 24, 2021 by avibootz
1 answer 162 views
1 answer 93 views
...