NBA - Boston Celtics

Wednesday, 5 September 2012

To check if value entered is alphabet or a digit..

#include<iostream.h>
#include<conio.h>
#include<ctype.h>
void main()
{
clrscr();
char ch;
cout<<"enter any no. or alphabet: ";
cin>>ch;
if(isdigit(ch))
{
 cout<<"It is a digit";
}
else if(isalpha(ch))
{
cout<<"It is a alphabet";
}
getch();
}

No comments:

Post a Comment