#include using namespace std; // ------------------------------------------------------------------ void binary_print(unsigned int n) { if (n > 1) binary_print( n / 2 ); cout << (n%2); } // ------------------------------------------------------------------ // Tool function void binary_println(unsigned int n) { cout << n << " : "; binary_print(n); cout << endl; } // ----------------------------------------------------------------- int main() { // Test cases binary_println(0); binary_println(1); binary_println(2); binary_println(4); binary_println(64); binary_println(1024); binary_println(5); binary_println(7); binary_println(37); binary_println(42); binary_println(255); // General case cout << "un entier : "; unsigned int n(0); cin >> n; binary_println(n); return 0; }