Program to illustrate isdigit( ) function


     #include <iostream.h>
    #include <ctype.h>                // defines the isdigit( ) function
    #include <conio.h>
       void main ()
    {
         char c , ans ;
         int a ;
       
         do
        {
        cout<<"\n Enter a character -" ;
        cin >>c ;
        if (isdigit (c) > 0)
            cout<<"\n The character is  digit ." ;
        else
            cout<<"\n The character is not a digit ." ;
        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|