Saturday, 25 July 2015

Write a program that check either entered letter is capital or small letter

Leave a Comment
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:

// 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;
       }

}




Output

If You Enjoyed This, Take 5 Seconds To Share It