Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. #include <cstring>
  2. void Prescurtat(char s[])
  3. {
  4. int reminder = 0, i, x, j = 0;
  5. char C[] = "COLEGIUL NATIONAL LICEUL TEORETIC", aux[102];
  6. for(i = 0; s[i] != '\0'; ++i)
  7. {
  8. if(s[i] == '.' && isalpha(s[i - 1]))
  9. {
  10. if(strchr(C, s[reminder]))
  11. {
  12. char *left = strchr(C, s[i - 1]);
  13. for(x = 1; left[x] !=' '; ++x)
  14. aux[j++] = left[x];
  15. reminder = i + 2;
  16. }
  17. }
  18. else
  19. aux[j++] = s[i];
  20. }
  21. aux[j] = '\0';
  22. for(i = 0; aux[i] != '\0' ; ++i)
  23. s[i] = aux[i];
  24. s[j] = '\0';
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement