Hello there, I want to ask about how would I go about not making chars case sensitive like when the user entered 'A' but the char variable is 'a', how would I go about this?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#include <iostream>
usingnamespace std;
int main ()
{
char a;
cout << "Please enter letter a: " << endl;
cin >> a;
if (a=='a')
{
cout << "Congrats you entered a!" << endl;
}
system ("pause");
return 0;
}
if (tolower(a) == 'a') // or with std:: is you're not using namespace std
Andy
PS I don't usually bother with islower to check a char if all I'm doing is lowering its case. When you pass a lower case char it just gives it back to you; so I would just use