Advertisement
Guest User

Untitled

a guest
Nov 17th, 2019
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. #include <string.h>
  2. #include <stdio.h>
  3. void scob ( char *s, int n);
  4. int main ()
  5. {
  6. int n;
  7. char s[20];
  8. gets (s);
  9. scob (s,n);
  10. puts (s);
  11.  
  12. }
  13. void scob ( char *s, int n)
  14. {
  15. char *p, *q;
  16. p=s;
  17. while (*p != '/0')
  18. {
  19. if ( *p < '0' || *p > '9')
  20. {
  21. q = strchr (p, '\0');
  22. while ( q != (p-1))
  23. {
  24. *(q+1)=*q;
  25. q--;
  26. }
  27. strncpy (p, "(", 1);
  28. while (*p < '0' || *p > '9')
  29. {
  30. p++;
  31. }
  32. q = strchr (p, '\0');
  33. while (q != (p-1))
  34. {
  35. *(q+1)=*q;
  36. q--;
  37. }
  38. strncpy (p, ")",1);
  39. }
  40. p++;
  41. }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement