C++ program to check character entered is alphabet, digit or special character using library functions.

Source Code:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
#include<iostream>
#include<cctype>
using namespace std;

int main()
{
 char ch;
 cout<<"Enter any character :";
 ch=getchar();
 if(isalpha(ch))
  cout<<"Alphabet";
 else if(isdigit(ch))
  cout<<"Number";
 else
  cout<<"Special Character";
 
 return 0;

Post a Comment

 
Top