This article uses algorithms to convert a 10-digit integer to a binary number. Note: Here is the general binary conversion rule, which is not necessarily represented by all systems. Logically, if the decimal number 5 is represented in one byte, it should be 101. You can add 1 continuously through 000 to get this number. However, division is generally used. 5/2 obtain the result that the quotient is 2 remainder and 1 consumer is 2/2. The result that the quotient is 1 remainder and 0 is 0 and the quotient is 0 remainder. The result is 1 and the remainder is in reverse order. (the final result is placed in a high position) the connection is 101. this algorithm can be implemented recursively: [cpp] // Convert decimal integer in one byte to binary format string ByteToBinaryString (char v) {if (v = 1) {return "1";} if (v % 2 = 0) {return ByteToBinaryString (v/2) + "0";} else {return ByteToBinaryString (v/2) + "1" ;}} ByteToBinalyString to convert a 10-digit integer stored in a byte to a string expressed in binary format. Every time ByteToBinalyString is called, the quotient and remainder divided by 2 are calculated first, and the consumer continues to call himself recursively. After the remainder is connected to the return value of the next recursive function, a reverse order is achieved. When the outlet provider is 1, "1" is returned directly when 1 is used to call itself ". After testing, there is basically no problem in positive numbers. If it is 0, an error occurs. Because recursion becomes infinite, there is no exit. So we need to add some code to ensure that the program can work normally when 0 is directly passed as the parameter. [Cpp] // Convert decimal integer in one byte to binary format string ByteToBinaryString (char v) {if (v = 1) {return "1 ";} if (v = 0) {return "0";} if (v % 2 = 0) {return ByteToBinaryString (v/2) + "0 ";} else {return ByteToBinaryString (v/2) + "1" ;}} now considers the case where the char value is smaller than 0. Obviously, this program still needs to be modified.