Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <windows.h>
- #include <format>
- using namespace std;
- int main()
- {
- SetConsoleOutputCP(1251);
- auto const n{ 8 };
- float x[n] = { 0.36, 0.79, 1.5, 0.9, 2.5, 3, 3.75, 4.2 }, y[n]{}, max{}, min{};
- int i{};
- for (i = 0; i <= n - 1; i++) {
- y[i] = (exp(abs(x[i] - 2)) + 2 * x[i]) / pow(sin(1.9 * pow(x[i], 2)), 4) + sqrt(pow(x[i], 3));
- }
- max = y[0];
- min = y[0];
- const auto table_format = "x = {:4.2f} \t y = {:4.2f} \n";
- for (i = 0; i <= n - 1; i++) {
- if (y[i] > max) {
- max = y[i];
- }
- if (y[i] < min) {
- min = y[i];
- }
- cout << format(table_format, x[i], y[i]);
- }
- cout << fixed;
- cout.precision(2);
- cout << "Максимальне значення - " << max << endl;
- cout << "Мінімальне значення - " << min << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement