Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- #include <stdlib.h>
- #include <ctype.h>
- int punctuation( char *s )
- {
- int i,
- szamlalo = 0,
- hossz = strlen(s);
- for(i = 1; i < hossz; i++)
- {
- if( (s[i] == '.' || s[i] == '!' || s[i] == '?') && (isalpha(s[i-1])) )
- {
- while(s[i] == '.' || s[i] == '!' || s[i] == '?')
- i++;
- if(s[i] == ' ' || s[i] == '\0')
- szamlalo++;
- }
- }
- return szamlalo;
- }
- #include <stdio.h>
- #include <stdlib.h>
- int main()
- {
- char line[ 1000 ];
- int punctuation( char * );
- while ( gets( line ) != NULL )
- printf( "%d\n", punctuation( line ) );
- return EXIT_SUCCESS;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement