Advertisement
Lavig

Лабораторна робота №6 (Завдання 2)

Oct 25th, 2024
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.57 KB | None | 0 0
  1. #include <iostream>
  2. #include <windows.h>
  3. #include <format>
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     SetConsoleOutputCP(1251);
  9.     const double p{ 3.14159 };
  10.     double xn{ 4.36 }, xk{ 14.63 }, dx{ 1.23 }, a{ 1.32 }, b{ 9.84 };
  11.     const auto table_format = "x = {:4.2f} \t y = {:4.2f} \n";
  12.     double x, y;
  13.     for (x = xn; x <= xk; x += dx) {
  14.         if (x <= b) {
  15.             y = (2 * pow(pow(log(x + b), 2), 1.0 / 3.0)) / (a * a + x * x);
  16.         }
  17.         else {
  18.             y = pow(x, cos(a + b));
  19.         }
  20.         cout << format(table_format, x, y);
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement