inbuilt fucntion number to binary c++ code example Example: convert int to binary string c++ std::string str = std::bitset<8>(123).to_string();