How do I make a program that reads an input thats not case sensitive?
I'm making a password program that I want not to be case sensitive. Can any one shed some light?
Printable View
How do I make a program that reads an input thats not case sensitive?
I'm making a password program that I want not to be case sensitive. Can any one shed some light?
That's an easy one, read the input however the user types it in and then parse the string to be all upper or lower case.
Be sure to include ctype.h in your program or toupper() and tolower() won't work.Code:int main(void){
char pWord[SIZE];
pWord = cin.getline();
for(int i = 0; i < SIZE; i++){
toupper(pWord[i]);
}
return 0;
}