Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<cmath>
- using namespace std;
- double func(float a, float x) {
- double F;
- F = (1. - a)*sin(a*a + a * x + 2.) / (1. + x * x);
- return F;
- }
- int main()
- {
- float h, b, a,x = 0;
- int n;
- double prom, ymin, ymax;
- cout << "h= "; cin >> h;
- cout << "b= "; cin >> b;
- cout << "n= "; cin >> n;
- for (int i = 0; i < 3; i++) {
- ymin = 100000;
- ymax = -100000;
- cout << "a= "; cin >> a;
- for (int j = 1; j <= n; j++) {
- x =b + (j * h);
- prom = func(a, x);
- if (ymin > prom) ymin = prom;
- if (ymax < prom) ymax = prom;
- }
- cout << ymin << endl << ymax << endl;
- }
- system("pause");
- return 0;
- }
Add Comment
Please, Sign In to add comment