Program to illustrate isalpha( ) function


    #include <iostream.h>           //defines the cout, cin object
    #include <ctype.h>             // defines the isalpha( ) function
    #include <conio.h>

    void main ( )
    {
         char c , ans ;
         int a ;
       
         do
        {
        cout<<"\n Enter a character -" ;
        cin >>c ;
        if (isalpha (c) > 0)
            cout<<"\n The character is an alphabet." ;
        else
            cout<<"\n The character is not an alphabet." ;
        cout<<"\n Do you want to continue ? (y or n) : ";
        cin >> ans;
         }
         while ( (ans == 'y') || (ans == 'Y') ) ;
         getch();
    }

0 comments:

Post a Comment

 
 
 
 


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