Advertisement
JStefan

[Kolokviumska] Cenzura

Dec 22nd, 2016
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.08 KB | None | 0 0
  1. /*
  2.     Cenzura
  3.  
  4.     Od Standarden vlez se chitaat N nizi od znaci(stringovi) ne podolgi od 80 znaci.
  5.     Sekoj od vchitanite stringovi treba da se kopirana specijalen nachin vo nov string na toj nachin shto pri kopiranje na mestoto na
  6.     samoglaskite vo prviot string ke se kopiraat * vo noviot string.Kopiraniot string da se otpechati na standarden izlez.
  7.  
  8. */
  9.  
  10. #include <stdio.h>
  11. #include <stdlib.h>
  12. #include <string.h>
  13.  
  14. void kopiraj(char[], char[], int);
  15. int e_samoglaska(char);
  16.  
  17. int main()
  18. {
  19.     int n, i;
  20.     scanf("%d", &n);
  21.  
  22.     char str[81];
  23.     char copy[81];
  24.     for(i = 0; i <= n; ++i) {
  25.         gets(str);
  26.         kopiraj(str, copy, 0);
  27.         puts(copy);
  28.     }
  29.     return 0;
  30. }
  31.  
  32. int e_samoglaska(char c) {
  33.     char ct = tolower(c);
  34.     return (ct == 'a' || ct == 'e' || ct == 'i' || ct == 'o' || ct == 'u');
  35. }
  36.  
  37. void kopiraj(char org[81], char copy[81], int i) {
  38.     if(i == strlen(org)) {
  39.         copy[i] = 0;
  40.     }
  41.     else {
  42.         if(e_samoglaska(org[i])) copy[i] = '*';
  43.         else copy[i] = org[i];
  44.         kopiraj(org, copy, i+1);
  45.     }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement