Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include "iostream"
- #include "iomanip"
- #include "math.h"
- using namespace std;
- int main()
- {
- bool flag = true;
- double x,xn,xk,dx,y,a,n,i,y1,y2,con;
- n=0; i=1;
- cout << "Enter xn,xk,dx,a:" << endl;
- // cin >> xn >> xk >> dx >> a;
- xn = -1.5;
- xk = 1.5;
- dx = 0.2;
- a = 2.17;
- con = log10(pow(a,2));
- for (x=xn; x<=xk; x=x+dx)
- {
- y1 = pow(x,2);
- y2 = fabs(a+y1)*con+3.4;
- y = pow(y2,0.5)/2;
- if(flag)
- {
- cout << "\nx parn=" << x << endl << "y parn=" << y << endl;
- }
- flag = !flag;
- }
- for (x=xn; x<=xk; x=x+dx)
- {
- y1 = pow(x,2);
- y2 = fabs(a+y1)*con+3.4;
- y = pow(y2,0.5)/2;
- if (y>0) {cout « "\ny=" « y; n=n+y; i=i*y;}
- }
- cout « "\nsuma=" « n «setw(10)« "proizv=" « i « endl;
- system("pause");
- return 0;
- }
Add Comment
Please, Sign In to add comment