Programming Tips - C/C++: Convert a HTTP status number into a range

Date: 2015aug19 Updated: 2024oct14 Language: C/C++ Q. C/C++: Convert a HTTP status number into a range A. Here is a simple function that does that.
// Eg 200 -> 200 // Eg 204 -> 200 int getStatusRange(const int status) { return (status / 100) * 100; } void exampleUse(const int status) { if (getStatusRange(status) == 200) { print "Success\n"; } else { print "Something else\n"; } }