1template <class T>
2T countDigits(T number)
3{
4 return T(log10(number) + 1);
5}
6//If the number is very large, use string
1int iNums = 12345;
2int iNumsSize = 5;
3for (int i=iNumsSize-1; i>=0; i--) {
4 int y = pow(10, i);
5 int z = iNums/y;
6 int x2 = iNums / (y * 10);
7 printf("%d-",z - x2*10 );
8}