Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /******************************************************************************
- Online C Compiler.
- Code, Compile, Run and Debug C program online.
- Write your code in this editor and press "Run" button to compile and execute it.
- *******************************************************************************/
- #include <stdio.h>
- #include<>
- int
- main ()
- {
- FILE *dtk1;
- FILE *dtk2;
- FILE *dtk3;
- int postanskiBrojevi[150] = { 0 };
- int i = 0;
- int datoteka2[150] = { 0 };
- int j = 0;
- dtk1 = fopen ("postanskiBrojevi", "r");
- if (dtk1 == NULL)
- {
- printf ("Error!");
- exit (1);
- }
- dtk2 = fopen ("dat2.txt", "r");
- if (dtk2 == NULL)
- {
- printf ("Error!");
- exit (1);
- }
- dtk3 = fopen ("dat3.txt", "w");
- if (dtk3 == NULL)
- {
- printf ("Error!");
- exit (1);
- }
- //-------------------------------------------- //
- while (!feof (dtk1))
- {
- fscanf (dtk1, "%d", &postanskiBrojevi[i]);
- i++;
- }
- while (!feof (dtk2))
- {
- fscanf (dtk2, "%d", &datoteka2[j]);
- j++;
- }
- // ------------------------------//
- for (int i = 0; i < 150; i++)
- {
- for (int j = 0; j < 150; j++)
- {
- if (datoteka2[j] >= postanskiBrojevi[i])
- break; //izadi iz druge for petlje neznam jeli break
- j++;
- }
- if (datoteka2[j] == postanskiBrojevi[i])
- continue // predi na iduci i
- fprintf (dtk3, "#d", postanskiBrojevi[i])}
- fclose (dtk1);
- fclose (dtk2);
- fclose (dtk3);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement