Advertisement
edutedu

rotire spre stanga varianta puncte

Sep 24th, 2020
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. #include <iostream>
  2. #include <string.h>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. char text[101], *p, aux[101];
  8. int l;
  9. cin.get(text ,101);
  10. int ok=0;
  11. p=strtok(text, " ");
  12. while(p)
  13. {
  14. l=strlen(p);
  15. if(l>=3);
  16. {
  17. ok=1;
  18. char pl=p[0];
  19. strcpy(p, p+1);
  20. p[l-1]=pl;
  21. p[l]=NULL;
  22. }
  23. strcat(aux, p);
  24. strcat(aux, " ");
  25. p=strtok(NULL, " ");
  26. }
  27. if(ok==0)
  28. cout<<"Nu exista";
  29. else
  30. {
  31. strcpy(text, aux);
  32. cout<<text;
  33. }
  34. return 0;
  35. }
  36.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement