Checking of entered character


    #include <iostream.h>
    void main()
    {
        char c ;
        cout<<"Enter any character :\n";
        cin>>c ;

        if ((c >= 'a') && (c <= 'z'))
            cout<<"The character is lower case.\n";
        else         if ((c >= 'A') && (c <= 'Z'))
            cout<<"The character is upper case.\n";
        else if ((c >= '0') && (c <= '9'))
                        cout<<"The character is numeric.\n";
                else
                        cout<<"The character is a symbol.\n";
    }

0 comments:

Post a Comment

 
 
 
 


Copyright © 2012 http://codeprecisely.blogspot.com. All rights reserved |Term of Use and Policies|