How to map integer values and round to a count of tens/thousands?
I didn't yet compiled it, but something like this should work:

#include &lt;Math.h&gt;

int converter(int x)
{
    if(x &lt;= 5000)
        return 1000;
    else 
        return (int)(round(x / 10000.0) * 10000.0);
}