4. Write a function to describe the binary representation of a given integer.
For example, a given integer131In binary format10000011, The function is required to output the following results:
1: 2
0: 5
1: 1
It indicates that it starts with a decimal bit and contains 2, 5, and 1.
Refer to the previous question to determine the name, entry exit, and return value of the function, and implement the function
// Js. cpp: defines the entry point of the console application. // # Include "stdafx. H "# include <iostream> using namespace STD; void parseint (int n); int _ tmain (INT argc, _ tchar * argv []) {int N; cin> N; parseint (n); System ("pause"); Return 0;} void parseint (int n) {int CNT = 0; int temp =-1; for (INT I = 0; I <8; ++ I) {If (N & (1 <I) {If (temp <0) // The first time {temp = 1; ++ CNT;} else if (temp! = 1) // encounter different numbers {cout <"0:" <CNT <Endl; // print the result temp = 1; CNT = 1 ;} else {CNT ++ ;}} else {If (temp <0) {temp = 0; ++ CNT ;}else if (temp! = 0) {cout <"1:" <CNT <Endl; // print the result of the previous section temp = 0; CNT = 1 ;} else {CNT ++ ;}}cout <temp <':' <CNT <Endl ;}