Reputation: 181
I'm working on a lab that requires password authentication as both an older c-string and a string class. I have the string class version working. I've gotten the password entered as an array using cin.getline(password, 20)
strlen(password)
also works correctly.
I've been searching for how to determing is the older c-string version contains an uppercase letter in any of it's values. Everything is saying to use isupper
, which is from the newer string class(as far as I can tell).
Is there a way to do this? I'm considering just verifying using the string class version then inputting it into the char array.
Upvotes: 1
Views: 7010
Reputation: 15857
Since you know that C
uses ASCII, you could create your own function:
bool upper(char chr)
{
return chr >= 'A' && chr <= 'Z'; // same as return chr >= 65 && chr <= 90
}
Upvotes: 1