Josif_tepe

Untitled

Jun 5th, 2026
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.86 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include <ctype.h>
  5.  
  6.  
  7. int main(int argc, char * argv[]) {
  8.     if(argc < 3) {
  9.         printf("Nema dovolno argumenti\n");
  10.         return 0;
  11.     }
  12.     FILE * in = fopen(argv[1], "r");
  13.     FILE * out = fopen(argv[2], "w");
  14.  
  15.     if(in == NULL || out == NULL) {
  16.         printf("Ne postoi datotekata\n");
  17.         return 0;
  18.     }
  19.  
  20.     char niza[2000], c;
  21.     int i = 0;
  22.  
  23.     while((c = fgetc(in)) != EOF) {
  24.         if(isalpha(c)) {
  25.             niza[i] = c;
  26.             i++;
  27.         }
  28.         else {
  29.             if(i % 2 == 0 && isupper(niza[0])) {
  30.                 for(int j = 0; j < i; j++) {
  31.                     fprintf(out, "%c", niza[j]);
  32.                 }
  33.                 fprintf(out, " ");
  34.             }
  35.             i = 0;
  36.             niza[0] = '\0';
  37.         }
  38.     }
  39.  
  40.     return 0;
  41. }
  42.  
Advertisement
Add Comment
Please, Sign In to add comment