Hi,
I have written this code:
However the output file looks like this:
How can I fix the "negative zero"?
I have written this code:
Code:
float x, y, y1, y2, z, e;
float deltax = 0.1, deltay = 0.1;
int width = 10;
int precision = 4;
outF << "Zeta" << setw(width) << "Eta" << endl;
outF.setf( ios::fixed | ios::showpoint );
outF.precision(precision);
for( x=0; x<=0.5; x+=deltax ){
y1 = 0.1*x;
y2 = 3*x;
for( y=y1; y<=y2; y+=deltay ){
z = (5.4*x - 1.8*y) / (1.2*y + 10.2);
e = (y - 0.1*x) / (0.1*x + 1.4);
outF << z << setw(width)<< e << endl;
}
}
Code:
Zeta Eta 0.0000 0.0000 0.0511 -0.0000 0.0331 0.0709
Comment