Finding Alphabets

#include <iostream>
#include <ctype.h>
using namespace std;
int main() {
char a,i;

  for(i=0;i<2;i++)
  {
    cin>>a;
    try
    {
  if(isalpha(a))
    cout<<"character "<<a<<" is alphabetic "<<endl;
  else
    throw(a);
    }
    catch(char e)
    {
      cout<<"character "<<e<<" is not alphabetic "<<endl;
    }
  }
return 0;
}

No comments:

Post a Comment