In: Computer Science
c++
Write the definition of a function named ‘isLower’ that takes as input a char value and returns true if the character is lowercase; otherwise, it returns false.•Print the message “The character xis lowercase” when returned value above is true, and vice versa.
#include <iostream>
using namespace std;
// function prototype
bool isLower(char ch);
int main()
{
char ch;
cout << "\nEnter a character: ";
cin >> ch;
if(isLower(ch))
cout << endl << "The character " << ch << " is in lowercase" << endl;
else
cout << endl << "The character " << ch << " is in uppercase" << endl;
return 0;
}
bool isLower(char ch)
{
// gets the ascii value of the character
int ascii = (int)ch;
if(ascii >= 65 && ascii <= 90)
return false;
else
return true;
}
****************************************************************** SCREENSHOT *********************************************************