Advertisement
Guest User

Untitled

a guest
Nov 19th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include <wctype.h>
  5.  
  6. int main(){
  7. char a[1001];
  8. int length, i, counter = 1, var1, var2;
  9. printf("Podaj tekst: \n");
  10. scanf("%1000[^\n]s", a);
  11. length = strlen(a);
  12. for(i=1; i < (length -1) ;i++){
  13. var1 = a[i-1];
  14. var2 = a[i];
  15. if(iswspace(var1) || iswpunct(var1)){
  16. (void)counter;
  17. } else if(iswspace(var2) || iswpunct(var2)) {
  18. counter = counter + 1;
  19. }
  20.  
  21. }
  22. printf("Liczba wyrazow: %d", counter);
  23. return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement