Advertisement
boyan16-z

Triangle? (files)

Mar 21st, 2018
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.43 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4.  
  5. int main() {
  6. FILE *s1, *s2;
  7. int a, b, c;
  8.  
  9. s1 = fopen("bit.txt", "r");
  10. s2 = fopen("bit2.txt", "w");
  11.  
  12. if (!s1)
  13. printf("Error open bit.txt\n");
  14. else
  15. {
  16. while (!feof(s1))
  17. {
  18. fscanf(s1, "%d %d %d\n", &a, &b, &c);
  19. if ((a + b > c) && (a + c > b) && (b + c > a)) {
  20. fprintf(s2, "%d %d %d\n", a, b, c);
  21. }
  22. }
  23. }
  24.  
  25. fclose(s1);
  26. fclose(s2);
  27. return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement