Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

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;
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #vector #decimal #binary
ADD COMMENT
Topic
Name
8+7 =