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 chet,stroka,chisla,poisk,vivod;
- cout<<"Enter posledov:";
- cin.getline(st, 39);
- stroka=strlen(st);
- chisla=chet=0;
- poisk=vivod=1;
- while (poisk<=stroka)
- {
- while (chet<stroka)
- {
- if ((st[chet]==' ') && (chisla==poisk))
- {
- while (vivod<=poisk+1)
- {
- cout<<st[chet-vivod];
- vivod++;
- }
- poisk=stroka+1;
- }
- else if (st[chet]==' ') {chisla=0;}
- else chisla++;
- chet++;
- }
- poisk++; chisla=chet=0;
- }
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment