Quipex icon

Laba_2.6_II

Quipex | PRO | 10/22/15 09:19:45 PM UTC | 0 ⭐ | 277 👁️ | Never ⏰ | []
C++ |

740 B

|

None

|

0 👍

/

0 👎

// Laba2.6_II.cpp : Defines the entry point for the console application.
//
 
#include "stdafx.h"
#include <iostream>
#include <math.h>
#include <clocale>
using namespace std;
 
int main()
{
    setlocale(0, "rus");
 
    double x,y,f;
    cout<<"Введите x и y через пробел:\n";
    cin>>x>>y;
 
    cout<<"Выберите f(x) (1 - sh(x), 2 - x^2, 3 - e^x):\n";
    int k;
    cin>>k;
    switch(k)
    {
        case 1:
            f=sinh(x);
            break;
 
        case 2:
            f=pow(x,2);
            break;
 
        case 3:
            f=exp(x);
            break;
    }
 
    double b;
    if(x/y>0)
    {
        b=log(f)+pow(abs(f),1.0/3);
    }
    else
        if(x/y<0)
        {
            b=log(abs(f/y))*pow(x+y,3);
        }
        else
            b=pow(pow(f,2)+y,3);
 
    cout<<endl<<"b="<<b<<endl;
    system("pause");
    return 0;
}

Comments