Questions:
A library function, islower(), 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 header 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. (See the SQRT program for clues.)
Code:
Output
A library function, islower(), 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 header 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. (See the SQRT program for clues.)
Code:
// check either its capital or small
letter
#include <iostream>
#include<ctype.h>
using namespace std;
int main()
{
char Temp;
cout<<"Enter a single character to check either its
capital or small == ";
cin>>Temp;
if(islower(int(Temp)))
{
cout<<"Entered letter is small letter"<<endl;
}
else
{
cout<<"Entered letter is Capital letter"<<endl;
}
}
1 Questions:
Why we use (islower(int(temp)))
Post a Comment