Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <ctype.h>
- int main(int argc, char * argv[]) {
- if(argc < 3) {
- printf("Nema dovolno argumenti\n");
- return 0;
- }
- FILE * in = fopen(argv[1], "r");
- FILE * out = fopen(argv[2], "w");
- if(in == NULL || out == NULL) {
- printf("Ne postoi datotekata\n");
- return 0;
- }
- char niza[2000], c;
- int i = 0;
- while((c = fgetc(in)) != EOF) {
- if(isalpha(c)) {
- niza[i] = c;
- i++;
- }
- else {
- if(i % 2 == 0 && isupper(niza[0])) {
- for(int j = 0; j < i; j++) {
- fprintf(out, "%c", niza[j]);
- }
- fprintf(out, " ");
- }
- i = 0;
- niza[0] = '\0';
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment