God. Damn. It. TO HEELLLL!!!
I do not know why I can't be done with this damn bloody thing. I may or may not improve it in the future, but it's pissing the hell out of me now. With some very, very good help from Swifty in fixing a careless mistake in the file output code, I've nearly got the program to where I need it to be to do my dirty work. But, because the universe generally hates me, there's still some bizzare quirks in the parsing code. Let's illustrate with an example of the output from the console window:
Enter the total number of fuselage stations. This number must be at least equal
to two.
2
Enter the total number of verticies to be drawn at each station. This number
must be at least equal to eight. The program will also force this number to be
even, rounding down.
16
Select the point of tangency for the elliptic section with the circular section.
You may use a measure of theta or a slope.
To use a measure of theta, press 0. Theta is measured from the bottom of the
circle (zero) to the top, which is 1 * pi.
To use a slope, press 1. A slope is negative on the top surface of the circle
and positive on the lower surface of the circle.
0
Enter the value of theta where the circular and elliptical sections are
tangent. Select a value between 0 and 1.
0.75
The following section requires precise data entry. Errors will necessitate re-
running the program.
Enter the z-coordinate of the number #1 station.
0
Enter the y-coordinate of the number #1 station's circular centerpoint.
0
Enter the radius of the circular section. The radius must be greater than 0.
1
Enter the height of the section apex. This coordinate must be between the point
of tangency between circular and elliptical sections and the y-intercept of the
tangent line; Use the absolute distance between the centerpoint and apex height.
For using a slope of -2.07, the apex limit is = 1.43896
1
Enter the z-coordinate of the number #2 station.
2.78
Enter the y-coordinate of the number #2 station's circular centerpoint.
1
Enter the radius of the circular section. The radius must be greater than 0.
2
Enter the height of the section apex. This coordinate must be between the point
of tangency between circular and elliptical sections and the y-intercept of the
tangent line; Use the absolute distance between the centerpoint and apex height.
For using a slope of -2.07, the apex limit is = 3.87792
3
Name the output file. NOTE: DO NOT ADD A FILE EXTENSION!
Anothertest
Parsing...
0
0 0 -1
0 0.382683 -0.92388
0 0.707107 -0.707107
0 0.92388 -0.382683
0 1 2.05103e-010
0 0.92388 0.382683
0 0.707107 0.707107
0 0.382683 0.92388
0 0 1
2.78 0 -1
2.78 0.765367 -0.847759
2.78 1.41421 -0.414214
2.78 1.84776 0.234633
2.78 2 1
2.78 1.84776 1.76537
2.78 1.41421 2.41421
2.78 0.765367 2.84776
2.78 0 3
EOF
File written. Check directory for output.
Press any key to continue . . .
This is the actual text output:
0
0.000000000 0.000000000 -325711365792980900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.000000000
0.000000000 0.382683432 -0.923879532
0.000000000 0.707106781 -0.707106781
0.000000000 0.923879533 -0.382683432
0.000000000 1.000000000 0.000000000
0.000000000 0.923879532 0.382683433
0.000000000 0.707106781 0.707106781
0.000000000 0.382683432 0.923879533
0.000000000 0.000000000 -325711229089810600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.000000000
2.780000000 0.000000000 -325711365792980900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.000000000
2.780000000 0.765366865 -0.847759065
2.780000000 1.414213563 -0.414213562
2.780000000 1.847759065 0.234633136
2.780000000 2.000000000 1.000000000
2.780000000 1.847759065 1.765366865
2.780000000 1.414213562 2.414213563
2.780000000 0.765366864 2.847759065
2.780000000 0.000000000 -325711229189934990000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.000000000
EOF
And here is the current source:
// HullForm.cpp : Defines the entry point for the console application. This is HullForm I.
// This is a geometry parsing program designed to output files to FreeShip.
#include "stdafx.h"
#include <iostream>
#include <cmath>
#include <cstdio>
#include <string>
#include <vector>
using namespace std;
int main()
{
/* This code may be expandable, but is at the moment only designed for use with a specific-case application. This case is that of the Blohm
und Voss P.212.03 fighter project, where the lower section of the hull is circular, while the upper section is elliptical. The program will
write a text file readable by the program "FreeShip," which will then output actual geometry usable by other software applications. This
version of the software is only reliable for producing fuselage sections as described above. */
// DECLARAION OF VARIABLES
int count; // This is a general purpose interger counter and selector variable.
int stations; // This is the number of hull sections to be parsed. This number must be at least 2.
int verts; // This is the number of verticies drawn at each hull station. 8 is the minimum number for a proper curve; 40+ are ideal.
double apex; // This is the highest point of an elliptical section of the hull.
double angle; // This is the radial angle n * pi that spaces the distance between each coordinate.
double a; // This is the width of an ellipse. This is datafield[ (5 + count) ].
double b; // This is the height of the ellipse. This is datafield[ (4 + count) ].
double radius; // This is the radius of a circular section of a hull. This is datafield[ (2 + radius) ].
double dx; // This is used as a temporary variable, and then as a proper variable in finding the center point of an elliptic section.
double dy; // This is used as a temporary variable, and then as a proper variable in finding the center point of an elliptic section.
double center; // This is the center coordinate of a circular section. This is datafield[ (1 + count) ].
double m; // This is the tangent slope where circular and elliptical sections of the fuselage meet.
double pi = 3.141592654; // Pi to nine decimal points. Whoo-Hoo!
double tangent; // This is the uniform point on the circular hull section with respect to theta that the elliptic section begins.
double tanEQ; // This is the equivalent measure of theta on the ellipse where both it and the circle are tangent; datafield[ (6 + count) ].
string extension = ".txt"; // This is the file type which is produced by running this code.
string filename; // This is the name of the output file.
FILE *File; // This is the output data.
vector<double> datafield; // This is a one-dimensional database which the parser reads through to plot geometry.
/* OTHER DECLARATIONS:
(I.) datafield[ count ] is the z-coordinate of a station.
(II.) datafield[ (3 + count) ] is the center coordinate of the section's elliptical geometry. */
// CODE EXECUTION: INITIAL PARAMETERS
// Section Details: Determine number of stations.
cout << "Enter the total number of fuselage stations. This number must be at least equal to two.\n\n";
cin >> stations; // This is a number used to determine the number of entries listed in the data vector.
while (stations < 2)
{
cout << "\nEnter the total number of fuselage stations. This number must be at least equal to two.\n\n";
cin >> stations;
}
stations = stations * 7; // Simplifies data input and computation. There are seven data entries per station.
datafield.resize( stations, 0 ); // Initializes the data vector, all values at zero.
/* Notes on section calculations: (a.) Clearly, there's not much calculation here. However, multiplying the number of stations by a numeric
constant, in this case 7, allows a proper number of data entries to be entered for each station. */
// Section Details: Data gathering for plotting behavior. Input station vertex count here.
cout << "\nEnter the total number of verticies to be drawn at each station. This number\n"
<< "must be at least equal to eight. The program will also force this number to be\n"
<< "even, rounding down.\n\n";
cin >> verts; // Number remains constant for entire program.
while (verts < 8)
{
cout << "\nEnter the total number of verticies to be drawn at each station. This number\n"
<< "must be at least equal to eight. The program will also force this number to be\n"
<< "even, rounding down.\n\n";
cin >> verts;
}
verts = verts - (verts % 2); // Operation ensures number of verticies is even.
// Section Details: Data gathering for circle-ellipse tangency processing. This is the tangent angle or slope.
cout << "\nSelect the point of tangency for the elliptic section with the circular section."
<< "You may use a measure of theta or a slope.\n\n";
cout << "To use a measure of theta, press 0. Theta is measured from the bottom of the\n"
<< "circle (zero) to the top, which is 1 * pi.\n\n";
cout << "To use a slope, press 1. A slope is negative on the top surface of the circle\n"
<< "and positive on the lower surface of the circle.\n\n";
cin >> count; // Here count is used as a selector. Alhough an int, decimals strangely seem to break the code...
while (count < 0 || count > 1)
{
cout << "\nTo use a measure of theta, press 0. Theta is measured from the bottom of the\n"
<< "circle (zero) to the top, which is 1 * pi.\n\n";
cout << "To use a slope, press 1. A slope is negative on the top surface of the circle\n"
<< "and positive on the lower surface of the circle.\n\n";
cin >> count;
}
if (count == 0)
{
cout << "\nEnter the value of theta where the circular and elliptical sections are\n"
<< "tangent. Select a value between 0 and 1.\n\n";
cin >> tangent;
while (tangent < 0 || tangent > 1)
{
cout << "\nEnter the value of theta where the circular and elliptical sections are\n"
<< "tangent. Select a value between 0 and 1.\n\n";
cin >> tangent;
}
m = tan(tangent * pi); // An error exists when a slope is vertical/infinite (division by zero). 0.5 * pi is to be avoided...
}
else
{
cout << "\nEnter the slope of the tangent line where circular and elliptical fuselage\n"
<< "sections meet. Values are all real numbers.\n\n"; // At the moment, that is blatantly a lie...
cin >> m; // Behavior at positive values is not an issue for the current project, but presents an instability to be adressed later.
if (m <= 0)
{
tangent = (atan(m)/pi) + 1; // The code currently cannot handle vertical or infinite slopes, or tangents at zero pi.
}
else
{
tangent = (atan(m)/pi); // The code currently cannot handle vertical or infinite slopes, or tangents at zero pi.
}
}
/* Notes on section calculations: (a.) Slope m for traditional circles and ellipses is the derivative of the function
(b^2 * x^2) + (a^2 * y^2) = a^2 * b^2, which can be written as (-b^2 * x) / (a^2 * y). Note that in a circle, a = b = r.
For traditional parametric calculations, x = a * cos(t), and y = b * sin(t), where t = theta = n * pi, where n is any
real number. The derivative thus reduces to (-b * cos(t)) / (a * sin(t)). If it is not already apparent, "b" is the
height of the ellipse or circle, while "a" is the width. Due to the shift in theta 90 degrees (0.25 * pi) clockwise for
computational reasons, the functions must be re-written to reflect the values to be used. Thus, x = a * sin(t), and
y = -b * cos(t), as 0 * pi starts at the bottom of the fuselage and moves counter-clockwise upwards. Re-writing the
equation of the derivative thus yields m = (b * sin(t)) / (a * cos(t)). This simply then reduces to m = (b/a) * tan(t).
A constant k can be defined as b / a, and is a useful quantity. However, this ratio is not needed in this code development
as only the tangent at the circular section is of interest in computations. (b.) The measure of theta determined in the else
statement is achieved through a reverse process of determining the slope of the tangent line as demonstrated in prior statments.
(c.) Revision notes: Code needs to be break-proof and all-aspect! Consider omitting variable m in the future. */
// CODE EXECUTION: FINE DATA ENTRY
cout << "\nThe following section requires precise data entry. Errors will necessitate re-\n"
<< "running the program.\n\n";
for (count = 0; count < stations; count = count + 7) // Uses count to cycle through vector entries whilst collecting information.
{
// Section Details: Assignment of given station's z-coordinate.
cout << "\nEnter the z-coordinate of the number #" << ((count/7) + 1) << " station.\n\n"; // Modifies the count to show station number.
cin >> datafield[ count ]; // Write z-value of station directly to the vector field.
// Section Details: Assignment of station's circular section center point in the y-axis.
cout << "\nEnter the y-coordinate of the number #" << ((count/7) + 1) << " station's circular centerpoint.\n\n";
cin >> center;
datafield[ (1 + count) ] = center; // Writes circular center point of station to the vector field.
// Section Details: Input of circular section radius for a given station.
cout << "\nEnter the radius of the circular section. The radius must be greater than 0.\n\n";
cin >> radius;
while (radius <= 0)
{
cout << "\nEnter the radius of the circular section. The radius must be greater than 0.\n\n";
cin >> radius;
}
datafield[ (2 + count) ] = radius; // Writes circular section radius to vector field.
// Section Details: Section apex entry and input check.
dx = (-0.5*radius) * ((1/cos(tangent * pi)) + cos(tangent * pi)); // Temporary reassignment of variable as centroid of limit region.
dy = (abs((radius * (cos(tangent * pi) - (1/cos(tangent * pi))))))/2; // Temporary reassignment of variable as radius of limit region.
cout << "\nEnter the height of the section apex. This coordinate must be between the point\n"
<< "of tangency between circular and elliptical sections and the y-intercept of the\n"
<< "tangent line; Use the absolute distance between the centerpoint and apex height.\n\n";
// cout << "The limits for placing the apex are between " << dx + center + dy << " and " << dx + center - dy << "\n\n"; // Old code...
cout << "\nFor using a slope of -2.07, the apex limit is = " << ((radius*sin(tangent*pi)) * 1.035)+(-1*radius*cos(tangent*pi)) + center
<< "\n\n"; // Proper limit formula needs to be derived for future versions.
cin >> apex;
// while ( (apex >= (dx + center + dy)) || (apex <= (dx + center - dy)) ) // Inaccurate limit system. Needs revision.
// {
// cout << "\nEnter the height of the section apex. This coordinate must be between the point\n"
// << "of tangency between circular and elliptical sections and the y-intercept of the\n"
// << "tangent line; Use the absolute distance between the centerpoint and apex height.\n\n";
// cin >> apex;
// }
/* Notes on section calculations: (a.) A point in space may exist between two limits if the limits are along the same 1-dimensional
plane, or if parameters for lateral movement are defined. This problem is set up only to consider the former. Limits are established by
the elevation of the point of tangency and the intercept of the slope of the tangent line on the y-axis. First, the locations of the
limits must be known. For the y-intercept, y = m*x + b. y = -r * cos(t), m = tan(t), x = r * sin(t). This is then:
-r*cos(t) = r*tan(t)*sin(t) + b. This becomes: -r*cos(t) - r*tan(t)*sin(t) = b. Then, -r * (cos(t) + tan(t)*sin(t)) = b. Note that
cos(t) + tan(t)*sin(t) = sec(t). Because secant is not an available function in <cmath>, sec(t) = 1/cos(t). Thus, the y-intercept is
b = -r/cos(t). The elevation of the point of tangency is simply equal to y, or -r * cos(t) at the specified measure of theta.
(b.) Terms must be combined and simplified for proper operation and clean implementation of algorithms. If the centroid or average
coordinate of the limit region is known, and the radius, or half of the distance between the coordinates is known, then the algorithm
"limit 1 > point > limit 2" can be implemented. Because the limits are of equal weight in importance, their order in the algorithm is of
no real concern, so long and the program properly recognizes of the points in relation to the coordinate to be entered into memory. The
average coordinate location, y-bar = ((m_1 * x_1) + (m_2 * x_2))/(m_1 + m_2). Because weights "m" are equal, m_1 = m_2, and the equation
becomes an arithmetic mean, y-bar = (x_1 + x_2)/2. The distance between two points is: d = ((x_1-x_2)^2)^0.5. Dividing this number by 2
delivers a radius: d_rad = (((x_1-x_2)^2)^0.5)/2. When combining terms from the first section, the following relations are derived:
y-bar = (-r/2)*((1/cos(t)) + cos(t)) (+ center coordinate of circular section)
d_rad = (((r * (cos(t) - (1/cos(t))))^2)^0.5)/2 (This looks much better on paper with proper symbology)
(c.) The above terms can now be used in an algorithm. An upper limit = y-bar + center + d_rad. The lower limit is y-bar + center - d_rad.
because a while loop is used for testing inputs, the algorithm must be altered. If the point must be less than limit 1, while the point
is greater than or equal to limit 1, the error check will continue to ask for a new value. For the lower limit, the condition is also
similarly reversed with respect to the original algorithm. This can be readily seen in the code above.
(d.) This section is for revision notes:
dy = (pow((pow(((radius * (cos(tangent * pi) - (1/cos(tangent * pi))))), 2)), 0.5))/2; // Old limit region radius code. This was
replaced by an absolute value function, where ideally the reduction of power operations will increase the efficiency of the code.
The limit code is now obsolete, and needs to be revised in the future. */
// Section Details: Computation of elliptic geometry center point.
dx = radius * sin(tangent * pi); // Proper use of dx...
dy = abs( apex + ( radius * cos(tangent * pi)) - center ); // And also the proper use of dy!
b = ( dy / 2 ) * ( 1 + pow(( 1 + (( 2 * dy )/( m * dx ))), -1 )); // Currently verified to function properly for values over 0.5 * pi.
tanEQ = acos((dy/b) - 1); // Returns a value in radians.
a = dx / (sin(tanEQ));
datafield[ (3 + count) ] = apex - b; // Plot the coordinate of the ellipse center to the data vector.
datafield[ (4 + count) ] = b; // Plot the height of the ellipse.
datafield[ (5 + count) ] = a; // Plot the width of the ellipse.
datafield[ (6 + count) ] = tanEQ; // Plot the equivalent value in radians where the point of tangency exists on the ellipse.
/* Notes on section calculations: (a.) "dx" forms the width of a quadrilateral used in a geometric proof to find the center of an
ellipse. This is the same as the x-coordinate on the circle where the point of tangency exists.
(b.) "dy" forms the height of a quadrilateral used to find the center of an ellipse. The other sides of the quadrilateral are formed by
the tangent line "m" and dx', which is a length from the base of dx along the tangent line to where the tangent line intersects with the
horizontal line formed at the top of dy. Length dy is a measure from the apex of the ellipse to height of the point of tangency on the
circular section. This distance is calculated whith an absolute value function, where abs( x_1 - x_2 ) = distance. The apex is x_1, and
is simply an input value, while x_2 is -r * cos(t) + center. The simplified version of this is seen above.
(c.) The height of the ellipse b is determined from a geometric relation formed from the above calculations and previously aquired
information. If a rectangle is drawn, with height dy and width dx, a centerpoint exists at (dx/2, dy/2). A line can be drawn which
crosses through the centerpoint and the intersection of the tangent line with dx'. This line crosses through the local (non-shifted)
origin of the ellipse. This line, crossing between two definable points, has a definable angle between itself and dx'. Line dx' also has
a definable length, dx' = dx + (dy/m), where m is the slope of the tangent line. Inverse tangent may be used to compute the angle between
dx' and the line (which forms a hypotenuse) because the center coordinates and intersection coordinates are known. Tangent may be used to
find the height b of the ellipse because the angle and the length of a side (dx') are known. Because tan(arctan(t)) = t, the height of
the ellipse function reduces from a trigonometric function to an algebraic function. The reduced form of this function is shown above. I
may provide a more detailed proof of this in later writing.
(d.) Because the height of the ellipse, b, has been calculated, the height of the y-coordinate from the relative center can be calculated
as dy is also known. y = b - dy. This provides a useful relation in determining the equivalent measure of theta at the elliptical section
of the fuselage commences. With the conventions of this program, the simplified version reduces to what is seen in the code above.
(e.) Finally, the width of the ellipse must be known for elliptical points to be plotted in a file. Via the conventions, an
x-coordinate = a * sin(t), where a is the width of an ellipse. Because the x-coordinate is equal to dx = r * sin(t) at the point of
tangency, this value is known. From the previous calculation, the equivalent measure of theta with respect to the tangent slope is also
known. The equation thus reduces to a = dx/sin(t), as seen in the code above.
(f.) To shift the center of the elliptic section properly with respect to the circular section, the simple relation apex - b is used.
(g.) Revision notes: Proofs need proper detailing and better formatting in the future.*/
}
// CODE EXECUTION: FILE PARSING
// Section Details: Name file and write contents.
cout << "\nName the output file. NOTE: DO NOT ADD A FILE EXTENSION!\n\n";
cin >> filename;
filename = filename + extension;
File = fopen( filename.c_str(), "w" );
if ( File != NULL )
{
// Section Details: List start.
cout << "\nParsing...\n\n";
// Section Details: Initializes file syntax.
cout << "\n0\n" << endl; // Denotes start of file; "0" signifies measurements are in meters.
fputs( "0\n\n", File );
for (count = 0; count < stations; count = count + 7) // Again re-using the counter. Very boss-like and professional. Or something.
{
// Section Details: Establish initial numerics for parsing computations.
angle = 2 / double(verts); // Computes the number of degrees theta (with respect to pi) between each vertex.
dy = 2; // Re-use dy to count the vertex number plotted. Count pre-set to 2 so as to count for the upcoming vertex.
// Section Details: Plot first coordinate semi-manually.
cout << "\t" << datafield[ count ] << "\t0\t" << ((datafield[ (2 + count) ] * (-1)) + datafield[ (1 + count) ]) << "\n";
fprintf( File, "\t%1.9f\t%1.9f\t%1.9f\n", datafield[ count ], 0, datafield[ (1 + count) ] - datafield[ (2 + count) ] );
// Section Details: Lower hull geometry parser. This uses the circular section data.
for (dx = angle; dx < tangent; dx = dx + angle) // Plot up to the tangent point.
{
cout << "\t" << datafield[ count ] << "\t" << (datafield[ (2 + count) ] * sin(dx * pi)) << "\t"
<< ((datafield[ (2 + count) ] * (-1) * cos(dx * pi)) + datafield[ (1 + count) ]) << "\n";
fprintf( File, "\t%1.9f\t%1.9f\t%1.9f\n", datafield[ count ], ((datafield[ (2 + count) ] * sin(dx * pi))),
((datafield[ (2 + count) ] * (-1) * cos(dx * pi)) + datafield[ (1 + count) ]) );
dy++; // Count verticies...
}
// Section Details: Plot point of tangency. This uses the elliptic section data.
cout << "\t" << datafield[ count ] << "\t" << (datafield[ (5 + count) ] * sin(datafield[ (6 + count) ])) << "\t"
<< ((datafield[ (4 + count) ] * (-1) * cos(datafield[ (6 + count) ])) + datafield[ (3 + count) ]) << "\n";
fprintf( File, "\t%1.9f\t%1.9f\t%1.9f\n", datafield[ count ], (datafield[ (5 + count) ] * sin(datafield[ (6 + count) ])),
((datafield[ (4 + count) ] * (-1) * cos(datafield[ (6 + count) ])) + datafield[ (3 + count) ]) );
dy++; // Count the vertex...
// Section Details: Prepare ellipse plotting calculations.
angle = (pi - datafield[ (6 + count) ]) / (((double(verts)/2) + 2) - dy); // Computes the number of radial degrees between verticies.
dx = angle; // Re-set dx as angle counter.
/* Notes on section calculations: (a.) The number of verticies on the side of a station is equivalent to the total number of vertices
desired for use in the station divided by two, plus one. This is because one vertex exists at the very top, while one exists at the
bottom. This assumes the number of verticies is even, which is enforced by the prior code. This formula, as incorporated into the
angle code, adds two due to the fore-count of counter dy: ((verts/2) + 1) - (dy - 1) = (verts/2) + 2 - dy.
(b.) Because pi is the top of the hull section, subtracting the equivalent radial degree of the tangent point on the ellipse from it
will yield the number of radial degrees to be traversed. Recall once more that variable tanEQ is measured in radians. By subtracting
the number of counted verts placed on the station to this point, dy, from dx (part (a.)) the number of verticies to be plotted can be
determined. Finally, dividing the number of degrees to be traversed by the number of verticies to be plotted yields the number of
degrees between each vertex to be plotted on the elliptical section. (Section will need revision in the future.) */
// Section Details: Parse elliptic hull sections.
while ( dy < ((verts / 2) + 1) ) // Somewhat sloppy revision to the code. Will be fixed in the future.
{
cout << "\t" << datafield[ count ] << "\t" << (datafield[ (5 + count) ] * sin(datafield[ (6 + count) ] + dx)) << "\t"
<< ((datafield[ (4 + count) ] * (-1) * cos(datafield[ (6 + count) ] + dx)) + datafield[ (3 + count) ]) << "\n";
fprintf( File, "\t%1.9f\t%1.9f\t%1.9f\n", datafield[ count ], (datafield[ (5 + count) ] * sin(datafield[ (6 + count) ] +dx)),
((datafield[ (4 + count) ] * (-1) * cos(datafield[ (6 + count) ] + dx)) + datafield[ (3 + count) ]) );
dx = dx + angle; // Augment that angle!
dy++; // Count that vertex!
}
// Section Details: Plot the final coordinate semi-manually for great justice, and to ensure no errors occur.
cout << "\t" << datafield[ count ] << "\t0\t" << (datafield[ (4 + count) ] + datafield[ (3 + count) ]) << "\n\n";
fprintf( File, "\t%1.9f\t%1.9f\t%1.9f\n\n", datafield[ count ], 0, datafield[ (4 + count) ] + datafield[ (3 + count) ] );
}
// Section Details: Finalizes file syntax.
cout << "\nEOF\n\n" << endl; // Ends the parsing of the file.
fputs( "\nEOF", File );
// Section Details: Close file and report.
fclose( File );
cout << "\nFile written. Check directory for output.\n\n";
}
return 0;
}
The first and last lines each for each of the station's y-coordinates are bugged! I have no idea why, and I have no idea of what the problem might be. I cleaned up the arithmetic for the y-coordinate of the first line, and there wasn't anything to do on the last line, but I'm baffled and pretty angry at this point. This needs to be done and over, and right when I'm ready to be done and over... this. If there are any bright ideas for why I'm getting this output, please do tell.