Advertisement
evage

Untitled

Jan 25th, 2022
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.84 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main(){
  5.     cout.setf(ios_base::fixed);
  6.     cout.precision(3);
  7.  
  8.     double ar[3][3] = {{0.2,0.5,2.1},
  9.                     {0.15,0.2,2.5},
  10.                     {0.9,5,2.7}};
  11.     cout << "Enter number of data set\n";
  12.     cout << "1, 2 or 3\n";
  13.     int n;cin>>n;
  14.     cout << "Enter x\n";
  15.     double x; cin>>x;
  16.     double a,b,z;
  17.     switch (n)
  18.     {
  19.     case 1:
  20.         a=ar[0][0];b=ar[0][1];z=ar[0][2];
  21.         break;
  22.     case 2:
  23.         a=ar[1][0];b=ar[1][1];z=ar[1][2];
  24.         break;
  25.     case 3:
  26.         a=ar[2][0];b=ar[2][1];z=ar[2][2];
  27.         break;
  28.     }
  29.     if (x < -log(a))
  30.         cout << a*sin(x)*sin(x)+b*cos(z*x);
  31.     else if (-log(a) <= x && x <= b)
  32.         cout << pow(a,b)-pow(cos(a+z*x),3);
  33.     else if (x > b)
  34.         cout << sqrt(2.5*pow(a,3)+pow(b-z*x*x,6));
  35. }
  36.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement