Advertisement
Guest User

Untitled

a guest
Nov 20th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. void fce(char c[], int x, char e[], int z) {
  5. /*if (c[1] == e[0]) {
  6. printf("1");
  7. }*/
  8. int f = 0;
  9. for (int d = 0; d < x; d++)
  10. {
  11. if (c[d] == e[f] || e[f] == '*' && f < z-1) {
  12. printf("$");
  13. f++;
  14. //printf ("%c", c[d]);
  15. }
  16. else { printf("-1"); }
  17. /*for (int d = 0; d < z; d++)
  18. {
  19. printf("%c", e[d]);
  20. }*/
  21. }
  22. }
  23.  
  24. int main()
  25. {
  26.  
  27. char str[] = { "nejake pole textu" };
  28. char vstup[] = { "ej*" };
  29. int z = sizeof(vstup) / sizeof(char);
  30. int x = sizeof(str) / sizeof(char);
  31. fce(str, x, vstup, z);
  32.  
  33. }
  34.  
  35.  
  36. /*void fce(char c[], int i) {
  37. //int i = sizeof(c);
  38. //c[2] = 'A';
  39. for (int l = 0; l < i; l++)
  40. {
  41. printf ("%c", c[l]);
  42. }
  43. }
  44.  
  45. int main()
  46. {
  47. char s[] = { "nejake pole textu" };
  48. int i = sizeof(s) / sizeof(char);
  49. fce(s, i);
  50.  
  51.  
  52. return 0;
  53. }*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement