rendered paste body#include <stdio.h>#include <stdlib.h>#define eil_ilg 200 FILE * f1; FILE * f2; FILE * f3; char stringas[eil_ilg]; char stringas2[eil_ilg]; int klaida = 0; struct eilsar { char eilute[eil_ilg]; struct eilsar *kitas; struct eilsar *atitink; } *galva = NULL, *elem = NULL, *galva2 = NULL, *elem2 = NULL;struct eilsar* nau_elem (struct eilsar *head, struct eilsar *item, char data[eil_ilg] ) { item->kitas = head; strcpy(item->eilute,data); head = item; item = NULL;return head; }void ispausdinam(struct eilsar *pop ) { do {fprintf(f3,"%s\n", pop->eilute); if (pop->atitink != NULL) { do { fprintf(f3,"|->%s\n", pop->atitink->eilute); pop->atitink= pop->atitink->atitink;} while (pop->atitink != NULL);} pop = pop->kitas;} while (pop->kitas != NULL); fprintf(f3,"%s\n\n", pop->eilute);} struct eilsar* rusiavimas (struct eilsar *head, struct eilsar *head2 ) { struct eilsar *head2backup, *tarp;char eil1[eil_ilg], eil2[eil_ilg]; char raid1, raid2;int lygu = 0, skirt = 0;int ilg1, ilg2;int n=0; head2backup = head2; do { do { strcpy(eil1,head->eilute); strcpy(eil2,head2->eilute); ilg1 = strlen(eil1); ilg2 = strlen(eil2); if (ilg1 == ilg2) { for (n=0; n<=ilg1; n++) { raid1 = eil1[n]; raid2 = eil2[n]; if (raid1 != raid2) { skirt = skirt + 1;}} if (skirt == 1) {lygu = 1;}} if (lygu == 1) { tarp = head->atitink; head->atitink = head2; head2->atitink = tarp;} ilg1 = 0; ilg2 = 0; lygu = 0; skirt = 0; head2 = head2->kitas;} while (head2->kitas != NULL); head= head->kitas; head2 = head2backup;} while (head->kitas != NULL);}int main(int argc, char *argv[]){ if (argc == 4) {if ((f1=fopen(argv[1],"r"))!=NULL) { while (feof(f1) == 0){ elem = malloc(sizeof(struct eilsar)); fgets (stringas, eil_ilg , f1); if (stringas == "") break; galva = nau_elem(galva, elem, stringas); strcpy(stringas, ""); }} else {printf("Failas nerastas:\n%s\n", argv[1]); klaida = 1;} if (klaida ==0) {if ((f2=fopen(argv[2],"r"))!=NULL) { while (feof(f2) == 0){ elem2 = malloc(sizeof(struct eilsar)); fgets (stringas2, eil_ilg , f2); if (stringas2 == "") break; galva2 = nau_elem(galva2, elem2, stringas2); strcpy(stringas2, ""); }} else {printf("Failas nerastas:\n%s\n", argv[2]); klaida = 1;}} if (klaida == 0){f3 = fopen(argv[3],"w"); rusiavimas(galva,galva2); ispausdinam(galva);}} else printf("Klaida: programa dirba su trimis failais,\nkuriu vardai ivedami kaip parametrai\n");system("PAUSE"); return 0;}