Advertisement
AlexandrTalchuk

3.1.11

Dec 29th, 2019
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.67 KB | None | 0 0
  1.  
  2.  
  3. #include "pch.h"
  4. #include <iostream>
  5. #include <limits>
  6. #include <math.h>
  7. #include <iomanip>
  8. #define M_PI 3.1415926
  9. using namespace std;
  10.  
  11.  
  12. int main(){
  13. setlocale(LC_ALL, "RUS");
  14. double a= -M_PI, b= M_PI, h = M_PI / 6, x=0, Y, min, max;
  15. int i=1;
  16. min=max= x * cos(x) / 2 - sin(x);
  17. for (x = a; x <= b; x+=h) {
  18.     Y = x * cos(x) / 2 - sin(x);
  19.    
  20.         if (Y < min)
  21.             min = Y;
  22.         else if (Y > max)
  23.             max = Y;
  24.  
  25.     cout <<setw(3)<< "№"<<i++<< setw(15)<<"x="<<x<<setw(15)<<"y="<<Y<< endl;
  26. }
  27.  
  28. cout << "Минимальное значение y=" << min << endl;
  29. cout << "Максимальное значение y=" << max << endl;
  30. system("pause");
  31. return 0;
  32.  
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement