I wrote a \'simple\' (it took me 30 minutes) program that converts decimal number to binary. I am SURE that there\'s a lot simpler way so can you show me? Here\'s the code:<
Here is modern variant that can be used for ints of different sizes.
ints
#include #include template std::enable_if_t,std::string> encode_binary(T i){ return std::bitset(i).to_string(); }