find length of an int string.

Jun 29, 2011 at 11:28am
to find a string length value it is strlen();, what is that for the int value and how do i do something below in c++?

1
2
3
int number = 15;
if (length_function_here(number) == 3)
return;


length_function_here being the function that can count the length of an int value
Last edited on Jun 29, 2011 at 11:29am
Jun 29, 2011 at 11:42am
to get an ints length divide it by 10 and add 1

EDIT - That will only work with positive numbers of course so divide the number by -1 first for negative numbers
Last edited on Jun 29, 2011 at 11:43am
Jun 29, 2011 at 12:26pm
Theres no such function like this in c++? o.o
Jun 29, 2011 at 12:31pm
Just last week I went looking for the function solveWorldsEnergyProblem() and that doesn't exist either.
Jun 29, 2011 at 2:18pm
1
2
3
4

if( 3 == sizeof( number ) )
    return;
Topic archived. No new replies allowed.