If you can't compute the range directly from the count as shown in Scott Hunter's answer (e.g., if the ranges aren't uniformly sized or the values they map to don't form a simple pattern), you can encapsulate a little table lookup like this:
#include <algorithm>
#include <utility>
#include <vector>
int FindRange(int count) {
static const std::pair<int, int> ranges[] = {
{ 0, 5 },
{ 200, 1 },
{ 400, 2 },
{ 600, 3 },
{ 800, 4 }
};
const auto it = std::find_if(std::begin(ranges), std::end(ranges),
[=](const std::pair<const int, int> &range) {
return count < range.first;
});
return (it == std::end(ranges)) ? ranges[0].second : it->second;
}
You can then change the table values and, as long as you keep them sorted, this function will continue to work.
It's a linear search through the table, so it should be on-par with the performance of a cascaded if-else.