Answers for "convert binary vector to decimal stl"

C++
1

c++ vector decimal to binary

std::string toBinary(int n)
{
    std::string r;
    while(n!=0) {r=(n%2==0 ?"0":"1")+r; n/=2;}
    return r;
}
Posted by: Guest on April-08-2021
7

convert binary to decimal c++ stl

string bin_string = "10101010";
int number =0;
number = stoi(bin_string, 0, 2);
// number = 170
Posted by: Guest on September-08-2020

Code answers related to "convert binary vector to decimal stl"

Browse Popular Code Answers by Language