how do I find an integer length? in pseudocode:
int whatup=100;
length=intlth(whatup);
//length now equals 3
is that possible?
how do I find an integer length? in pseudocode:
int whatup=100;
length=intlth(whatup);
//length now equals 3
is that possible?
Teh most direct method is to calculate the floor of the log base 10 of the number (you can find the appropriate functions std::floor, and std::log10 in <cmath>).
You can also do it by dividing by ten (and incrementing a counter) until the value equals zero (since its integer arithmetic).
The word rap as it applies to music is the result of a peculiar phonological rule which has stripped the word of its initial voiceless velar stop.
That doesn't work, does it? Log(87), for example, is ~1.94. floor(1.94) is 1. So you'll need to do what he said, and then add 1. But instead of using floor, can't you just cast it to an int and let the decimals truncate?Originally posted by Zach L.
Teh most direct method is to calculate the floor of the log base 10 of the number (you can find the appropriate functions std::floor, and std::log10 in <cmath>).
Away.
Oh yeah... forgot that little detail.
The word rap as it applies to music is the result of a peculiar phonological rule which has stripped the word of its initial voiceless velar stop.