include
# include
# include "executer.h"
# include "triangle.h" ()
{ex ("data tri.dat"); (); 0;
}. h:
# ifndef EXECUTER_H
# define EXECUTER_H
# include
# include
# include "triangle.h" {: (char * file);: delBad (Triangle * triangles [], int & minAngle, int & maxAngle, char * file); drawAll (Triangle * triangles []); areTheyCrossing (Triangle * triangles [], int minAngle, int maxAngle);
};
# endif.cpp:
# include
# include
# include
# include
# include
# include
# include "executer.h"
# include "triangle.h"
# define PI 3.141592654 :: Executer (char * file) {* fPtr; * triangles [50] = {0}; c, i, count, maxAngle, minAngle, flag, step, val [ 6] = {0}; integer [10] = {' 0'}; gdriver = DETECT, gmode, errorcode; (& gdriver, & gmode, ""); = graphresult (); (errorcode! = grOk)
{("Graphics error:% s n", grapherrormsg (errorcode)); ("Press any key to halt:");. get (); (1);
} ((fPtr = fopen (file, "r")) == NULL) {<<"Can't open file!" <
} = 0; = 0; = 0; = 0; ((c = getc (fPtr))! = EOF) {((c == 'A' | | c == 'a ') && flag == 0) = 1; ((c ==' N '| | c ==' n ') && flag == 1) = 2; ((c ==' G '| | c ==' g ') && flag == 2) = 3; (flag == 3) {(c ==' = ') {((c = getc (fPtr)) ==' '); [count + +] = c; (isdigit (c = getc (fPtr))) [count + +] = c; = 0; [step + +] = atoi (integer); (int j = 0; j <10; j + + ) [j] = ' 0';
}
} (step == 6) {[i + +] = new Triangle (val [0], val [1], val [2], val [3], val [4], val [ 5]); = 0; = 0;
}
} (fPtr); (triangles, minAngle, maxAngle, file); (triangles); (triangles, minAngle, maxAngle);
} Executer :: delBad (Triangle * triangles [], int & minAngle, int & maxAngle, char * file)
{* fPtr; angle, min = 999.0, max = -1.0; i, val [6] = {0}; temp0 [5] = {' 0'}, temp1 [5] = {' 0'}, temp2 [5] = {' 0'}, [5] = {' 0'}, temp4 [5] = {' 0'}, temp5 [5] = {' 0 '}; ((fPtr = fopen (file, "w")) == NULL) {<<"Can't open file!" <
} (i = 0; triangles [i]! = 0; i + +) ((angle = (* triangles [i]). isObtuse ())> PI/2) {(angle < ;...