Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- char s[80];
- int slovo, count = 0;
- cin.get(s, 80);
- int i = 0;
- while (s[i] == ' ' && s[i] != '\0')
- {
- i++;
- slovo = 0;
- }
- while (s[i] != '\0') {
- if (s[i] != ' ' && slovo == 0)
- {
- slovo = 1;
- count++;
- }
- else if (s[i] == ' ')
- {
- slovo = 0;
- i++;
- }
- else if (s[i] == '...')
- {
- slovo = 0;
- i++;
- }
- else if (s[i] == '.' && slovo == 0)
- {
- slovo = 1;
- count++;
- }
- }
- cout << count;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement