4
Fonctions booléennes
- #include <stdio.h>
- #include <ctype.h>
- void pctype( int c ) {
- printf( "%3d(%02X)\t'%c' is a ", c, c, c );
- if ( isdigit( c ) )
- printf("digit");
- else if ( islower( c ) )
- printf("small letter");
- else if ( isupper( c ) )
- printf("capital letter");
- else if ( isspace( c ) )
- printf("space");
- else if ( iscntrl( c ) )
- printf("control");
- else if ( ispunct( c ) )
- printf("punctuation");
- else
- printf("mistery");
- printf(".\n");
- }
- main() {
- int c;
- for ( c = 0; c < 128; ++c )
- pctype(c);
- }
Commentaires