Advertisement
Guest User

Untitled

a guest
Aug 20th, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. #include <stdio.h>
  2. //
  3. //char s[10];
  4. //scanf("%9s", s);
  5.  
  6.  
  7. //ana are mere -> 3
  8. //ana are mere -> 3
  9. //ana are.mere -> 2
  10. // a na are mere -> 3
  11. /*
  12.  
  13. while(nu am terminat inputul){
  14. while (spatiu) skip
  15. countWord
  16. while (!spatiu) skip
  17. }
  18.  
  19. */
  20.  
  21.  
  22. int main(){
  23.  
  24. unsigned nWord=0;
  25. int c=1;
  26. while (c!=EOF){
  27. while ((c=getchar())==' ');
  28. if (c!='\n') nWord++;
  29. while (((c=getchar())!=' ') && (c!=EOF));
  30. if (c==EOF) printf("am gasit capat");
  31. }
  32. printf("Am gasit %d cuvinte", nWord);
  33. return 0;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement