Advertisement
Guest User

Untitled

a guest
Jan 19th, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. char s[80];
  7. int slovo, count = 0;
  8. cin.get(s, 80);
  9. int i = 0;
  10. while (s[i] == ' ' && s[i] != '\0')
  11. {
  12. i++;
  13. slovo = 0;
  14. }
  15. while (s[i] != '\0') {
  16. if (s[i] != ' ' && slovo == 0)
  17. {
  18. slovo = 1;
  19. count++;
  20. }
  21. else if (s[i] == ' ')
  22. {
  23. slovo = 0;
  24. i++;
  25. }
  26. else if (s[i] == '...')
  27. {
  28. slovo = 0;
  29. i++;
  30. }
  31. else if (s[i] == '.' && slovo == 0)
  32. {
  33. slovo = 1;
  34. count++;
  35. }
  36. }
  37. cout << count;
  38. system("pause");
  39. return 0;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement