~A library function, is lower(), takes a single character (a letter) as an argument and returns a nonzero integer if the letter is lowercase, or zero if it is uppercase. This function requires the file CTYPE.H. Write a program that allows the user to enter a letter, and then displays either zero or nonzero, depending on whether a lowercase or uppercase letter was entered.
CODE:
#include <iostream>
#include <ctype.h>
/* Author: Danial Ahmed
Website: http://program-cpp.blogspot.com/
Contact: danyalphc@gmail.com */
using namespace std;
int main(){
char a;
cout << "Enter letter: ";
cin >> a;
cout << islower(a) << endl;
return 0;
}
OUTPUT:
If lowercase
If uppercase
No comments:
Post a Comment