Advertisement
Maksud3

TiFreakYaEbu

Oct 8th, 2019
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.60 KB | None | 0 0
  1. #define USE_MATH_DEFINES
  2. # define M_PI           3.14159265358979323846
  3. #include<iostream>
  4. #include<math.h>
  5. #include<conio.h>
  6. #include<Windows.h>
  7. using namespace std;
  8. int main()
  9. {
  10.  
  11.     SetConsoleOutputCP(1251);
  12.     const int n = 6;
  13.     float x[n];
  14.     float y;
  15.     double yArray[n];
  16.     cout << "Введіть елементи масива:" << endl;
  17.     for (int i = 0; i < n; i++)
  18.     {
  19.         cout << "Введіть " << i+1 << "елемент : " ;
  20.         cin >> x[i];
  21.     }
  22.     cout << endl;
  23.     float minx = x[0], maxx = x[0];
  24.     for (int i = 0; i < n; i++)
  25.     {
  26.         y = pow((M_PI), 2) * pow(sin(x[i]), 2) + log(((x[i] + 1) / x[i]) + 1);
  27.         cout << "Вивід " << x[i] << " [y] = " << y << endl;
  28.  
  29.         yArray[i] = y;
  30.         if (x[i] < minx)
  31.         {
  32.             minx = x[i];
  33.         }
  34.         if (x[i] > maxx)
  35.         {
  36.             maxx = x[i];
  37.         }
  38.  
  39.        
  40.     }
  41.     double miny = yArray[0], maxy = yArray[0];
  42.     cout <<endl<< "Утворений масив : " << endl;
  43.     for (int i = 0; i < n; i++)
  44.     {
  45.         cout << "Число x№" << i + 1 << " " << x[i] << " " ;
  46.         cout << "\tЧисло y№" << i + 1 << " " << yArray[i] << " "<<endl ;
  47.         if (yArray[i] < miny)
  48.         {
  49.             miny = yArray[i];
  50.         }
  51.         if (yArray[i] > maxy)
  52.         {
  53.             maxy = yArray[i];
  54.         }
  55.     }
  56.     cout << "\nВивести наймеше значення масиву x[i] :" << minx<< endl;
  57.     cout << "Вивести найбільше значення масиву x[i] :" << maxx << endl<<endl;
  58.     cout << "\nВивести наймеше значення масиву y[i] :" << miny << endl;
  59.     cout << "Вивести найбільше значення масиву y[i] :" << maxy << endl;
  60.     while (!_kbhit());
  61.     return 0;
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement