int nBit = 1; int nNum = 1234567; nNum = abs(nNum); while(nNum = nNum / 10) { ++nBit; } nBit即所求整数的位数。