Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <wctype.h>
- int main(){
- char a[1001];
- int length, i, counter = 1, var1, var2;
- printf("Podaj tekst: \n");
- scanf("%1000[^\n]s", a);
- length = strlen(a);
- for(i=1; i < (length -1) ;i++){
- var1 = a[i-1];
- var2 = a[i];
- if(iswspace(var1) || iswpunct(var1)){
- (void)counter;
- } else if(iswspace(var2) || iswpunct(var2)) {
- counter = counter + 1;
- }
- }
- printf("Liczba wyrazow: %d", counter);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement