Here is a very simple and recursively written C++ program to convert a decimal integer number into its binary equivalent. However it returns the binary equivalent in the form of a string of characters but you can very easily write an other function to convert this string into an actual binary number as well.
This program inputs a positive integer from user, checks whether it is a complete square or not and outputs the result to the user.
We use three variables in this program. n is used to store the number under check which is input by the user. i is initialized from 0 and then incremented by one during the execusion of a while loop. m is used to store the square of i during each loop. The loop executes as long as square of i i. e m is less than the number n. After this loop, an if selection statement is used to check whether this square which we have obtained as a result of execution of this loop is equal to the number n or not? if, it is, then we tell the user that the number he entered is a complete square. Otherwise we display a message on the screen stating that this number is not a complete square.