Advertisement
Guest User

Untitled

a guest
Dec 11th, 2018
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. #include <iostream>
  2. #include <string.h>
  3. //nr 2 problema 2
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. char s[101],aux[101];
  9. int i=0,j;
  10. cin.get(s,101);
  11. do
  12. {
  13. while(s[i]==' ')
  14. i++;
  15. j=i;
  16. while(s[j]!=' ')
  17. j++;
  18. if((j-i)%2==0)
  19. {
  20. strcpy(aux,s+j);
  21. s[j]='#';
  22. strcpy(s+j+1,aux);
  23. }
  24. i=j;} while(i<strlen(s));
  25.  
  26.  
  27.  
  28. cout<<s;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement