Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string.h>
- //nr 2 problema 2
- using namespace std;
- int main()
- {
- char s[101],aux[101];
- int i=0,j;
- cin.get(s,101);
- do
- {
- while(s[i]==' ')
- i++;
- j=i;
- while(s[j]!=' ')
- j++;
- if((j-i)%2==0)
- {
- strcpy(aux,s+j);
- s[j]='#';
- strcpy(s+j+1,aux);
- }
- i=j;} while(i<strlen(s));
- cout<<s;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement