Friday, December 4, 2009

C++->Capital letter, Small letter, a Digit or a Special character.

Input a character and check whether it is a Capital letter, Small letter, a Digit or a Special character.
#include
void main()
{
char ch;
ch=getchar();
if(ch >= ’A’ && ch <= ’Z’)
cout<<”Capital letter”;
else
if(ch >= ’a’ && ch <= ’z’)
cout<<”Small letter”;

else
if(ch >= ’0’ && ch <= ’9’)
cout<<”Digit”;
else
cout<<”Special character ”;
}

0 comments:

Post a Comment

Followers