Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- #include <ctype.h>
- int main(int argc, char * argv[]) {
- if(argc < 3) {
- printf("Imeto na vlezna i izlezna datoteka se vnesuvaat kako argumenti od komadna linija\n");
- return 0;
- }
- FILE *in = fopen(argv[1], "r");
- FILE *out = fopen(argv[2], "w");
- if(in == NULL) {
- printf("Ne vnesovte validna datoteka za vlez\n");
- return 0;
- }
- if(out == NULL) {
- printf("Ne vnesovte validna datoteka za pecatenje\n");
- return 0;
- }
- int j = 0;
- char niza[2000];
- char c;
- while((c = fgetc(in)) != EOF) {
- if(isalpha(c)) {
- niza[j] = c;
- j++;
- }
- else {
- if(isupper(niza[0]) && j % 2 == 0) {
- for(int i = 0; i < j; i++) {
- fprintf(out, "%c", niza[i]);
- }
- fprintf(out, "\n");
- }
- j = 0;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement