I have the following,
int intMilliseconds = rawSplit % 1000;
which returns the milliseconds left from a time that i have entered, however it in very few cases returns three number (###) instead of the usual two (##).
How might i get it to always return two numbers? (##)
Any help would be great thanks !
It’s going to be a three-digit number any time
rawSplitis a number between x,099 and x,999. The modulo operator%gives you the remainder after dividing by the right-hand operand. If you perform1064 % 1000, the result is64. If you perform1548 % 1000, the result is548.You can change the information you’re getting — performing modulo 100, for example:
1064 % 100 -> 64and1548 % 100 -> 48— but you can’t make this expression “return” two digits all the time.From my comment below:
I guess you could use “centiseconds”; just divide your milliseconds by ten and drop the fractional part.