Advertisement
Guest User

Untitled

a guest
Nov 19th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.55 KB | None | 0 0
  1. /******************************************************************************
  2.  
  3. Online C Compiler.
  4. Code, Compile, Run and Debug C program online.
  5. Write your code in this editor and press "Run" button to compile and execute it.
  6.  
  7. *******************************************************************************/
  8.  
  9. #include <stdio.h>
  10. #include<>
  11.  
  12. int
  13. main ()
  14. {
  15. FILE *dtk1;
  16. FILE *dtk2;
  17. FILE *dtk3;
  18. int postanskiBrojevi[150] = { 0 };
  19. int i = 0;
  20. int datoteka2[150] = { 0 };
  21. int j = 0;
  22.  
  23. dtk1 = fopen ("postanskiBrojevi", "r");
  24. if (dtk1 == NULL)
  25. {
  26. printf ("Error!");
  27. exit (1);
  28. }
  29.  
  30. dtk2 = fopen ("dat2.txt", "r");
  31. if (dtk2 == NULL)
  32. {
  33. printf ("Error!");
  34. exit (1);
  35. }
  36.  
  37. dtk3 = fopen ("dat3.txt", "w");
  38. if (dtk3 == NULL)
  39. {
  40. printf ("Error!");
  41. exit (1);
  42. }
  43. //-------------------------------------------- //
  44. while (!feof (dtk1))
  45. {
  46. fscanf (dtk1, "%d", &postanskiBrojevi[i]);
  47. i++;
  48. }
  49.  
  50. while (!feof (dtk2))
  51. {
  52. fscanf (dtk2, "%d", &datoteka2[j]);
  53. j++;
  54. }
  55.  
  56. // ------------------------------//
  57. for (int i = 0; i < 150; i++)
  58. {
  59. for (int j = 0; j < 150; j++)
  60. {
  61. if (datoteka2[j] >= postanskiBrojevi[i])
  62. break; //izadi iz druge for petlje neznam jeli break
  63.  
  64. j++;
  65. }
  66. if (datoteka2[j] == postanskiBrojevi[i])
  67. continue // predi na iduci i
  68. fprintf (dtk3, "#d", postanskiBrojevi[i])}
  69.  
  70. fclose (dtk1);
  71. fclose (dtk2);
  72. fclose (dtk3);
  73. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement