The essence of the task: to choose the best screen resolution for the user, based on his data. I need to ompare user value with value from ENUM and return the appropriate one. For example:
enum class Resolutions {
V720_height = 720,
V720_width = 1280,
V1080_height = 1080,
V1080_width = 1920
};
int main() {
int user_height = 1200;
int user_width = 430;
// I know this does not work, just an example.
std::for_each(Resolutions.begin(), Resolutions.end(), [](Resolutions tmp) {
if (static_cast<int>(tmp) > user_height) {
std::cout << tmp << " - is better resolution\n";
}
});
}
I need a good idea, how can this be implemented?