Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include "string.h"
- #include "iostream"
- #include "iomanip"
- #include "math.h"
- using namespace std;
- int _tmain(int argc, _TCHAR* argv[])
- {
- char st[40];
- int i,j,n,k;
- cout<<"Enter posledov:";
- cin.getline(st, 39);
- j=strlen(st);
- n=k=i=0;
- while (i<j)
- {
- if ((st[i]==' ') && (n==5))
- {k=k+1; n=0;}
- else if (st[i]==' ')
- {n=0;}
- else n++;
- i++;
- }
- if (n==5) {k=k+1;}
- cout<<k<<endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment