用求一個數的個位數來依次比較
int CountDigit( int number, int digit ) { int conpare,count; if (number <0) { number = number*-1; } while (number >10) { conpare = number %10; number = number/10; if (conpare == digit) count++; } if (number == digit) count++; return count; }