Advertisement
Guest User

Untitled

a guest
Oct 20th, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. #include "xuly.h"
  2. #define _CRT_SECURE_NO_WARNINGS
  3. #include <string.h>
  4.  
  5. void xuly(char s[], char kq[], int& d, int& maxx)
  6. {
  7. kq[0] = s[0];
  8. kq[1] = '\0';
  9. char t[51];
  10. int dem, k;
  11. do
  12. {
  13. strcpy(t,""); // sua cho nay
  14. dem = 0; k = 0;
  15. for (int i = 0; i < strlen(s); i++)
  16. if (s[0] == s[i])
  17. dem++;
  18. else
  19. {
  20. t[k] = s[i];
  21. k++;
  22. }
  23. t[k] = '\0';
  24. if (maxx < dem)
  25. {
  26. strcpy(kq, ""); //sua cho nay
  27. maxx = dem;
  28. kq[0] = s[0];
  29. d = 0;
  30. kq[1] = '\0';
  31. }
  32. else if (maxx == dem)
  33. {
  34. d++;
  35. kq[d] = s[0];
  36. kq[d + 1] = '\0';
  37. }
  38. strcpy(s, t);
  39. } while (strcmp(s, "")); //sua cho nay
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement