Advertisement
Guest User

Untitled

a guest
Nov 19th, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.00 KB | None | 0 0
  1. #include <iostream>
  2. #include <iomanip>
  3. #include <Windows.h>
  4. #include <cmath>
  5. #include <conio.h>
  6. using namespace std;
  7.  
  8. int main()
  9. {
  10.     SetConsoleCP(1251);
  11.     SetConsoleOutputCP(1251);
  12.      float x, d, F;
  13.     int N,A,B;
  14.  
  15.     do
  16.     {
  17.         cout << "Введите значение A: " << endl;
  18.         cin >> A;
  19.         cout << "Введите значение B: " << endl;
  20.         cin >> B;
  21.         if (A == B) cout << "A не должно быть равным B, введите новые значения" << endl;
  22.     } while (A == B);
  23.  
  24.     cout << "Введите количество элементов N:" << endl;
  25.     do
  26.     {
  27.         cin >> N;
  28.         if (N <= 2) cout << "Количество элементов должно быть больше 2, введите новое значение" << endl;
  29.     } while (N <= 2);
  30.     x = A;
  31.     d = (B - A) / (N - 1);
  32.     while (x <= B)
  33.     {
  34.         if (x != - M_PI / 4.0 + M_PI )
  35.         {
  36.             F = (1.0/4.0 - x * x * tan(x)) / (sin(x) + cos(x));
  37.             cout << setw(15) << left << x << F << endl;
  38.         }
  39.         x = x + d;
  40.     }
  41.     return 0;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement