Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- #define PI 3.1413
- using namespace std;
- class formula {
- public:
- double x,
- y,
- z,
- res;
- bool flag;
- void vvod() {
- flag = 0;
- cout << "Enter x = ";
- cin >> x;
- cout << "Enter y = ";
- cin >> y;
- cout << "Enter z = ";
- cin >> z;
- }
- void run() {
- if(((fabs(x - y)) * z + x * x) == 0){
- flag = 1;
- return;
- }
- double acot_x = PI/2. - atan(x);
- res = (5. * acot_x) -
- ((1./4) * acos(x)) *
- ((x + (3. * (fabs(x - y))) + x * x) /
- ((fabs(x - y)) * z + x * x));
- }
- void vivod() {
- if(flag == 1)
- cout << "Error: denominator = 0" << endl;
- else
- cout << "Result = " << res << endl;
- }
- };
- int main() {
- formula f1;
- f1.vvod();
- f1.run();
- f1.vivod();
- formula *pf2 = new formula;
- pf2->vvod();
- pf2->run();
- pf2->vivod();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement