Program to illustrate iscntrl ( ) function


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

    void main ()
    {
         char c , ans ;
         int a ;
         do
        {
        cout<<"\n Enter a character -" ;
        cin >>c ;
        if (iscntrl (c) > 0)
            cout<<"\n The character is a control character ." ;
        else
            cout<<"\n The character is not a control character." ;
        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|