Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main()
- {
- FILE *fp, *fd, *fv;
- fp = fopen("cisla1.txt","r");
- fd = fopen("cisla2.txt","r");
- fv = fopen("vysledok.txt","w");
- int cisla1;
- int cisla2;
- int prvy = fscanf(fp,"%d",&cisla1);
- int druhy = fscanf(fd,"%d",&cisla2);
- while (prvy > 0 || druhy > 0) {
- while (prvy > 0 && (druhy<=0 || cisla1 <= cisla2))
- {
- fprintf(fv, "%d ", cisla1);
- prvy = fscanf(fp, "%d", &cisla1);
- }
- while (druhy > 0 && (prvy<=0 || cisla2 <= cisla1))
- {
- fprintf(fv, "%d ", cisla2);
- druhy = fscanf(fd, "%d", &druhy);
- }
- }
- fclose(fp);
- fclose(fd);
- fclose(fv);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement