https://pastein.ru/t/UE
скопируйте уникальную ссылку для отправки
// 1
/*#include <iostream>
#include <math.h>
#include <iomanip>
using namespace std;
float get_y(float x)
{
return (x * x * x + 2 * x) / (3 * cos(sqrt(x)) + 1);
}
void main() {
// a
{
const float delta_x = 0.4;
cout << "a)" << endl
<< setw(10) << "X" << setw(10) << "Y" << endl;
for (float x = 0; x <= 2; x += delta_x)
cout << setw(10) << x << setw(10) << get_y(x) << endl;
}
cout << endl;
// b
{
const float delta_x = 0.8;
char count = 7;
cout << "b)" << endl
<< setw(10) << "X" << setw(10) << "Y" << endl;
for (float x = 0.3; count > 0; x += delta_x,count--)
cout << setw(10) << x << setw(10) << get_y(x) << endl;
}
}*/
//3
#include <iostream>
#include <math.h>
#include <iomanip>
using namespace std;
void main() {
float x_start, x_end, x_delta, y;
cout << "x start >> ";
cin >> x_start;
cout << "x end >> ";
cin >> x_end;
if (x_end < x_start)
return;
cout << "x delta >> ";
cin >> x_delta;
cout << endl << "results" << endl
<< setw(10) << "X" << setw(10) << "Y" << endl;
for (float x = x_start; x <= x_end; x+=x_delta)
{
if (x < 0 || x > 8)
continue;
if (x <= 0.5)
y = atan(x) + exp(x);
else
y = log(x + sin(x));
cout << setw(10) << x << setw(10) << y << endl;
}
}