Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Untitled

a guest Nov 19th, 2018 70 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top