Search
 
SCRIPT & CODE EXAMPLE
 

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;
}
Comment

PREVIOUS NEXT
Code Example
Cpp :: c++ primality test 
Cpp :: ob for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details. 
Cpp :: select one random element of a vector in c++ 
Cpp :: cpp print vector 
Cpp :: make cin cout faster 
Cpp :: c++ typedef array 
Cpp :: is javascript for websites only 
Cpp :: c++ round number down 
Cpp :: initialize vector to all zeros c++ 
Cpp :: c++ messagebox 
Cpp :: c++ delete directory 
Cpp :: pair in stack 
Cpp :: c++ check if string contains substring 
Cpp :: merge images opencv c++ 
Cpp :: print array c++ 
Cpp :: Name one example of a “decider” program that you regularly encounter in real life. 
Cpp :: dev c++ tahe last word error 
Cpp :: change const value c++ 
Cpp :: how to make a sqlite3 object in cpp 
Cpp :: qt qmessagebox 
Cpp :: extern __shared__ memory 
Cpp :: initialize 2d vector of ints c++ 
Cpp :: note++ 
Cpp :: create n threads cpp 
Cpp :: convert string to number c++ 
Cpp :: minimum and maximum value of a vector in C++ 
Cpp :: maximum value in map in c++ 
Cpp :: sort function descending c++ 
Cpp :: run c++ file putty 
Cpp :: vector to string c++ 
ADD CONTENT
Topic
Content
Source link
Name
8+7 =