Here is the set of screen resolution which I want to validate in pair when user input in.
Aspect ratio - 4:3
800 x 600
1024 x 768
1152 x 864
1280 x 960
etc..
Currently here is what I am thinking:
int arrWidth[] = {800, 1024, 1152, 1280};
int arrHeight[] = {600, 768, 864, 960};
for ( int i = 0; i < sizeof(arrWidth)/sizeof(arrWidth[0]); ++i) {
if ( pInputWidth == arrWidth[i] ) {
if ( pInputHeight == arrHeight[i] ) {
// both width and height is good
return true;
}
// width good, but height doesn't match
return false;
}
}
// width doesn't match at all
return false;
Is there any better way to do this?