0_liprikon_0

Миша_ VI

Jun 16th, 2021
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.91 KB | None | 0 0
  1. #include <iostream>
  2. #include <locale>
  3.  
  4. using namespace std;
  5.  
  6. float f(float x) {
  7.     if (x == 1 || x == -1)
  8.         return 1;
  9.     if (x >= 0 && x != 1)
  10.         return -1 / (1 - x);
  11.     if (x < 0 && x != -1)
  12.         return 1 / (1 + x);
  13. }
  14.  
  15. int main()
  16. {
  17.     setlocale(LC_ALL, "Russian");
  18.     cout << "Программа, которая строит таблицу значений функции УМЛ-111 Никульченков М.Е.\n";
  19.     float a, b, h, x, z;
  20.     cout << "a= ";
  21.     cin >> a;
  22.     cout << "b= ";
  23.     cin >> b;
  24.     cout << "h= ";
  25.     cin >> h;
  26.     cout << "x\tf(x)\n";
  27.  
  28.     for (x = a; x <= b; x += h) {
  29.         cout << x << "\t";
  30.         if (x == 1 || x == -1)
  31.             z = 1;
  32.         if (x >= 0 && x != 1)
  33.             z = -1 / (1 - x);
  34.         if (x < 0 && x != -1)
  35.             z = 1 / (1 + x);
  36.         cout << z << endl;
  37.     }
  38.     system("pause");
  39.     return 0;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment