check lowercase letters c++
In C++, to check if a character is a lowercase letter, you can use the islower()
function from the <cctype>
library. This function takes a character as an argument and returns a non-zero value if the character is a lowercase letter, and 0 otherwise. Here's an example of how you can use it:
#include <iostream>
#include <cctype>
int main() {
char ch = 'a';
if (islower(ch)) {
std::cout << "The character is a lowercase letter." << std::endl;
} else {
std::cout << "The character is not a lowercase letter." << std::endl;
}
return 0;
}