Szanowni koledzy mój kod wygląda następująco
#include <fstream>
#include <iostream>
#include <math.h>
#include <iomanip>
using namespace std;
int main()
{
double y;
fstream file;
file.open("wyniki.txt",ios::in|ios::out|ios::trunc);
for(double x = 0.20,a = 1; x <= 0.50; x += 0.01 , a++)
{
if(x < 0.30)y = -log(pow(x,2)) + exp(x);
else if ((x >= 0.30) && (x < 0.40)) y = (1/tan(pow(x,2) + 4));
else if (x >= 0.40) y = tan(pow(x,2) + 1);
cout << y << endl;
file << "|Dla x = " << setw(4)<< x << ",y => " <<setw(9) << y << "|\t";
if(!(int(a) % 2))
{
file << "\n";
}
}
file.close();
}
Czy ktoś mógłby mi rozjaśnić czemu nie ma żadnej wartości dla x = 0.50, i jak to mogę poprawić?