i am bit confused about the logic to calculate number of digits in a number!

What do you mean by number of didgits in a number? An armstrong number is only three digits. if you have a number xyz then x^3 + y^3 + z^3 = xyz for an armstrong number.

Are you having a hard time seperating out the digits from the start and stop numbers? If that is the case then you can break out the digits of a number as follows. note: I am storing the individual digits into an vector so they can be used later

std::vector<int> digits
int number; // this is the number we will get the digits out of example 371
while (number != 0) // once we get all of the digits stop
{
digits.push_back(number % 10); // this gets the right most digit
number /= 10; // this gets rid of the right most digit
}
// right now the vector holds 1, 7, 3
// if you want to have the digits in the vector reversed then use
// this needs the <algorithm> header included
std::reverse(digits.begin(), digits.end());