Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - Write a function that counts the number of times that the number 1, 2, 3 appears in every bit of the integer n. Input and output should be completed in the main function.
Write a function that counts the number of times that the number 1, 2, 3 appears in every bit of the integer n. Input and output should be completed in the main function.
When doing this, there are several 1, 2, 3 in the number of 20, and several digits of 1, 2, 3 are not counted, so write:

int? cs(int? iNum,int? iChar)

{

int? iCount? =? 0;

while(iNum)

{

If (iChar? ==? iNum% 10)

{

icount++;

}

iNum/= 10;

}

Return? iCount

}

int? Master ()

{

int? a,m,n,j;

CIN & gt; & gta;

m=cs(a, 1);

n=cs(a,2);

j=cs(a,3);

cout & lt& ltm & lt& lt"?" & lt& ltn & lt& lt"?" & lt& ltj;

Return? 0;

}