Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. void Prescurtat(char s[])
  2. {
  3. int i,ad, j, n = strlen(s) - 1;
  4. char t[200];
  5. for(i = 0; i <= n; ++i)
  6. {
  7. if((i == 0 || (s[i - 1] == ' ')) && strchr("CLNT", s[i]))
  8. {
  9. j = i;
  10. while(s[j] != ' ' && j <= n)
  11. ++j;
  12. if(s[j - 1] == '.' || (j > n && s[n] == '.'))
  13. {if(s[i] == 'C')
  14. strcpy(t,"COLEGIUL");
  15. else
  16. if(s[i] == 'L')
  17. strcpy(t,"LICEUL");
  18. else
  19. if(s[i] == 'N')
  20. strcpy(t, "NATIONAL");
  21. else
  22. strcpy(t, "TEORETIC");
  23.  
  24. strcpy(t + strlen(t), s + j);
  25. strcpy(s + i, t);
  26. n += strlen(t);
  27. }
  28. }
  29. }
  30. j = strlen(s) - 1;
  31. if(s[j] == '.')
  32. {
  33. while(s[j] != ' ')
  34. j--;
  35. j++;
  36. // cout<<s[j]<<'\n';
  37. if(s[j] == 'C')
  38. strcpy(t,"COLEGIUL");
  39. else
  40. if(s[j] == 'L')
  41. strcpy(t,"LICEUL");
  42. else
  43. if(s[j] == 'N')
  44. strcpy(t, "NATIONAL");
  45. else
  46. strcpy(t, "TEORETIC");
  47. strcpy(s + j, t);
  48. }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement