
























Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

























String Handling
Character
Example 1
ctype Functions int isdigit ( int c ) int isalpha ( int c ) int isalnum ( int c ) int isxdigit ( int c ) int islower ( int c ) int isupper ( int c ) int tolower ( int c ) int toupper ( int c ) int isspace ( int c ) int iscntrl ( int c ) int ispunct ( int c ) int isprint ( int c ) int isgraph ( int c )
isalpha ( ) Function int isalpha ( int c ) ;
isalnum ( ) Function int isalnum ( int c ) ;
isupper ( ) Function int isupper ( int c ) ;
tolower ( ) Function int tolower ( int c ) ;
getchar ( ) ;
cout << “Please enter a character string then press enter”; while ( ( c = getchar ( ) ) != ‘\n’ ) { if ( islower ( c ) ) lc ++ ; else if ( isupper ( c ) ) uc ++ ; else if (isdigit ( c ) ) dig ++; else if ( isspace ( c ) ) ws ++ ; else if ( ispunct ( c ) ) pun ++ ; else oth ++ ; }
atoi ( ) Function char str [ ] ; int age ; age = atoi ( str ) ;
atof ( ) Function