floor function for c++

Hi,

I want to write a function that applies the floor function to (x/10) and if the number is bigger than 10, then apply the function again, or else keep it as it is.

For example, if x = 20, then I want the answer to be 2, but if x = 100, then the answer should be 1.


Please help and thanks in advance!!!!
I want to write a function that applies the floor function to ...

Well, then let's start coding. We are expecting your efforts...
h(k) = floor of (x/10)

if (h(k) => 10)
h(k) = floor of ((h(k))/10)
else
return h(k)

that's what I have so far.. but I am supposed to write a "perfect hash function". I am not quite sure if I am doing it right...


Thanks!
Topic archived. No new replies allowed.