Need help with capital and lowercase letters

Hi guys,
I am writing a code that requires the user to input either B or b for bright or D or d for dim. Basically, B is bright and D is dim but I have to code the program such that it allows for both he capital letter and the lowercase letter to be recognized. How would I go about doing this?

Any help is appreciated!
Thanks!
J
You could convert the character to lowercase and compare it:
http://www.cplusplus.com/reference/cctype/tolower/

Having two separate comparisons for both capital and lowercase is also a common solution but it's quite redundant.
Last edited on
Topic archived. No new replies allowed.