convert int to binary string c++

C++
std::string str = std::bitset<8>(123).to_string();

Source

Also in C++: