Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "pch.h"
- #include <iostream>
- #include <limits>
- #include <math.h>
- #include <iomanip>
- #define M_PI 3.1415926
- using namespace std;
- int main(){
- setlocale(LC_ALL, "RUS");
- double a= -M_PI, b= M_PI, h = M_PI / 6, x=0, Y, min, max;
- int i=1;
- min=max= x * cos(x) / 2 - sin(x);
- for (x = a; x <= b; x+=h) {
- Y = x * cos(x) / 2 - sin(x);
- if (Y < min)
- min = Y;
- else if (Y > max)
- max = Y;
- cout <<setw(3)<< "№"<<i++<< setw(15)<<"x="<<x<<setw(15)<<"y="<<Y<< endl;
- }
- cout << "Минимальное значение y=" << min << endl;
- cout << "Максимальное значение y=" << max << endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement