Quipex

Laba_2.6_II

Oct 22nd, 2015
305
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.74 KB | None | 0 0
  1. // Laba2.6_II.cpp : Defines the entry point for the console application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include <iostream>
  6. #include <math.h>
  7. #include <clocale>
  8. using namespace std;
  9.  
  10. int main()
  11. {
  12.     setlocale(0, "rus");
  13.  
  14.     double x,y,f;
  15.     cout<<"Введите x и y через пробел:\n";
  16.     cin>>x>>y;
  17.  
  18.     cout<<"Выберите f(x) (1 - sh(x), 2 - x^2, 3 - e^x):\n";
  19.     int k;
  20.     cin>>k;
  21.     switch(k)
  22.     {
  23.         case 1:
  24.             f=sinh(x);
  25.             break;
  26.  
  27.         case 2:
  28.             f=pow(x,2);
  29.             break;
  30.  
  31.         case 3:
  32.             f=exp(x);
  33.             break;
  34.     }
  35.  
  36.     double b;
  37.     if(x/y>0)
  38.     {
  39.         b=log(f)+pow(abs(f),1.0/3);
  40.     }
  41.     else
  42.         if(x/y<0)
  43.         {
  44.             b=log(abs(f/y))*pow(x+y,3);
  45.         }
  46.         else
  47.             b=pow(pow(f,2)+y,3);
  48.  
  49.     cout<<endl<<"b="<<b<<endl;
  50.     system("pause");
  51.     return 0;
  52. }
Advertisement
Add Comment
Please, Sign In to add comment