1void show_binary( int dec )
2{
3 std::cout << "decimal = " << dec << "\n";
4
5 std::string bin{};
6
7 while( dec > 0 ) {
8 if( dec % 2 == 0 ) bin.insert( bin.begin( ), '0' );
9 else bin.insert( bin.begin( ), '1' );
10
11 dec >>= 1;
12 }
13
14 std::cout << "binary = " << bin << "\n";
15}