Answers for "c++ vector decimal to binary"

C++
0

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

Browse Popular Code Answers by Language