By DePaul Dimadis
Choose your prefered Language: greek_flag uk_flag

A machine tool works with 2 rotating axes of circular cross section with known diameters of 1.2DD, respectively. Due to the operation of the axes, their geometry changes in different points, so their cuts at various points along their length are not completely circular.
A serial file named crs.txt contains in each line of:
(a) two double numbers corresponding to the length in mm of two perpendicular diameters of one section perpendicular to the axis of rotation of each axle.
b) A double number that corresponds to the distance of the incision, in mm, from the beginning of the axis
c) An integer positive number, 1 or 2, indicating the axis of rotation
example for 1110,2180DD ==
180.81 179.93 0.22 2
109.55 109.57 0.15 1
110.22 110.44 0.19 1
...
Specify a structure named crd to manage the dimensions of the diameters of these sections. The data private members of the structure are the four above-mentioned numbers.
Set a table of crd, N-type structures (N = known).
The data in the table of structures will be entered by accessing the crs.txt serial file if the absolute value of the difference in the two diameters of each line of the file is greater than 2% of the diameter of the corresponding axis (1D or 2D).
Assume that the value of N exceeds the number of records in the file.
The following are requested (main () function:
1. Import the data from the crs.txt file into the table of structures as described above by checking the existence of the file (see the code below) and find and display the number of lines in the file that the table of structures.
2. Using all the elements in the table of structures to find and display:
a. the number of incisions of each axis
b. the mean value of the deviations of each of the two measured diameters of each axle from the initial diameter of each axle, excluding the zero deviations, with an accuracy of 10-4.
(NOTE: you must specify 4 values, 2 for each axis)
FILE * fp;
errno_t err;
...
if (err = (fopen_s (& fp, filename, mode))! = 0)
{
printf (\"error reading file .... \\ n\");
exit (1);
}
else // reading from file
{