Tuesday, 24 December 2013

Any character is entered through the keyboard, write a program to determine whether the character entered is a capital letter, a small case letter, a digit or a special symbol. The following table shows the range of ASCII values for various characters. Characters ASCII Values for various characters.


#include<iostream>
 using namespace std;
#include<conio.h>
int  main()

{

  char Inpu;

 

  cout<<"Enter any single letter, digit or special symbol : ";

 cin>>Inpu;

  if(Inpu>=65&&Inpu<=90)

  {

    cout<<"You entered a CaPITaL LETTER.\n";

  }

  if(Inpu>=97&&Inpu<=122)

  {

    cout<<"You entered Inpu SMaLL LETTER.\n";

  }

  if(Inpu>=48&&Inpu<=57)

  {

    cout<<"You entered a DIGIT.\n";

  }

  if((Inpu>=0&&Inpu<=47)||(Inpu>=58&&Inpu<=64)||(Inpu>=91&&Inpu<=96)||(Inpu>=123&&Inpu<=127))

  {

    cout<<"You entered an SPECIaL SYMBOL.\n";

  }

  getche();
  return 0;

}

No comments:

Post a Comment