Showing posts with label Small letter. Show all posts
Showing posts with label Small letter. Show all posts

Sunday, August 23, 2015

Check Capital, Small, Digit, Special Character from Keyboard Input


Q. 86. Program to accept a character and print if its a Capital letter, Small letter, Digit or Special Character.


Copy Code:

#include<iostream>

using namespace std;

int main()

{

  char ch ;

  cout << "Enter any character : ";

  cin >> ch;

  

  if (ch>='A'  &&  ch<='Z')

     cout << ch << " is a Capital Letter";

  else if (ch>='a'  &&  ch<='z')

     cout << ch << " is a Small Letter";

  else if (ch>='0'  &&  ch<='9')

     cout << ch << " is a Digit";

  else 

     cout << ch << " is a Special Character";

   return(0);

}