AddO1f

Lab2_1

Oct 11th, 2015
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.59 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include "math.h"
  3. #include "iostream"
  4. #include "conio.h"
  5.  
  6. using namespace std;
  7.  
  8. int main()
  9. {
  10.     double x,y,f,a;
  11.     int k;
  12.     cout << "Enter x="; cin >> x;
  13.     cout << "Enter y="; cin >> y;
  14.     cout << "Choose f: 1-sh(x), 2-x^2, 3-exp(x) f="; cin >> k;
  15.     switch(k)
  16.     {
  17.         case 1: sinh(x); break;
  18.         case 2: pow(x,2); break;
  19.         case 3: exp(x); break;
  20.         default: cout << "Function not chosen"; return 1;
  21.      }
  22.     if (x*y>0) a=(x+y)*(x+y)-pow(fabs(x),1/3);
  23.     else if (x*y<0) a=(x+y)*(x+y)+sin(x);
  24.     else a=(x+y)*(x+y)+pow(y,3);
  25.     cout << "Result=" << a << endl;
  26.     _getch();
  27.     return 0;
  28. }
Add Comment
Please, Sign In to add comment