#include void binary_print(int value) { if ( value < 2 ) // is the binary equivalent a digit? cout << value; // yes! so, print it else { // no -- it's a (number.digit) binary_print( value / 2 ); // print the number cout << value % 2; // print the digit } } int main () { int value; cout << "Enter a decimal value: "; cin >> value; while (value > 0) { cout << "Binary = "; binary_print(value); cout << endl; cout << endl << endl << "Enter a decimal value: "; cin >> value; } }