Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define USE_MATH_DEFINES
- # define M_PI 3.14159265358979323846
- #include<iostream>
- #include<math.h>
- #include<conio.h>
- #include<Windows.h>
- using namespace std;
- int main()
- {
- SetConsoleOutputCP(1251);
- const int n = 6;
- float x[n];
- float y;
- double yArray[n];
- cout << "Введіть елементи масива:" << endl;
- for (int i = 0; i < n; i++)
- {
- cout << "Введіть " << i+1 << "елемент : " ;
- cin >> x[i];
- }
- cout << endl;
- float minx = x[0], maxx = x[0];
- for (int i = 0; i < n; i++)
- {
- y = pow((M_PI), 2) * pow(sin(x[i]), 2) + log(((x[i] + 1) / x[i]) + 1);
- cout << "Вивід " << x[i] << " [y] = " << y << endl;
- yArray[i] = y;
- if (x[i] < minx)
- {
- minx = x[i];
- }
- if (x[i] > maxx)
- {
- maxx = x[i];
- }
- }
- double miny = yArray[0], maxy = yArray[0];
- cout <<endl<< "Утворений масив : " << endl;
- for (int i = 0; i < n; i++)
- {
- cout << "Число x№" << i + 1 << " " << x[i] << " " ;
- cout << "\tЧисло y№" << i + 1 << " " << yArray[i] << " "<<endl ;
- if (yArray[i] < miny)
- {
- miny = yArray[i];
- }
- if (yArray[i] > maxy)
- {
- maxy = yArray[i];
- }
- }
- cout << "\nВивести наймеше значення масиву x[i] :" << minx<< endl;
- cout << "Вивести найбільше значення масиву x[i] :" << maxx << endl<<endl;
- cout << "\nВивести наймеше значення масиву y[i] :" << miny << endl;
- cout << "Вивести найбільше значення масиву y[i] :" << maxy << endl;
- while (!_kbhit());
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement