josiftepe

Untitled

Dec 25th, 2020
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.36 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3. #define MAX 100
  4.  
  5.  
  6. //ne menuvaj!
  7. void wtf() {
  8. FILE *f = fopen("sp.txt", "w");
  9. char c;
  10. while((c = getchar()) != EOF) {
  11. fputc(c, f);
  12. }
  13. fclose(f);
  14. }
  15. void rff() {
  16. FILE *f = fopen("output.txt", "r");
  17. char c;
  18. while((c = fgetc(f)) != EOF) {
  19. putchar(c);
  20. }
  21. fclose(f);
  22. }
  23. int e_samoglaska(char c) {
  24. if(c == 'A' || c == 'a' || c == 'E' || c == 'e' || c == 'I' || c == 'i' || c == 'O' || c == 'o' || c == 'U' || c == 'u') {
  25. return 1;
  26. }
  27. return 0;
  28. }
  29.  
  30. int main() {
  31. wtf();
  32.  
  33. FILE *f = fopen("sp.txt", "r");
  34. FILE *out = fopen("output.txt", "w");
  35. // fprintf(out, "Zdravo");
  36. // if(f != NULL) { // toa znaci deka datotekata postoi
  37. int k;
  38. fscanf(f, "%d", &k);
  39. char c;
  40. char niza[5001];
  41. while(fgets(niza, 5000, f) != NULL) { // EOF - end of file
  42. for(int i = 0; i < strlen(niza); i++) {
  43. c = niza[i];
  44. if(e_samoglaska(c) == 1) {
  45. int brojac = k;
  46.  
  47. while(brojac > 0) {
  48. printf("%c", c);
  49. brojac -= 1;
  50. }
  51. }
  52. else {
  53. printf("%c", c);
  54. }
  55. }
  56. }
  57.  
  58. // }
  59. rff();
  60. return 0;
  61.  
  62. }
  63.  
Advertisement
Add Comment
Please, Sign In to add comment