Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string.h>
- using namespace std;
- int main()
- {
- char str[100];
- cout << "Vvedite stroku: ";
- cin.getline(str, 100);
- int n=strlen(str);
- int count=0;
- for(int i=n-1;i>0 ; i--)
- {
- if(str[i]==' '&& str[i-1]!=' ')
- {
- for(int j=i-1 ; str[j]!=' ';j--)
- {
- count++;
- }
- for(int k=0 ; k<count ; k++)
- {
- for(int d =i-count-1 ; d<n-1 ; d++)
- {
- str[d]=str[d+1];
- }
- n--;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement