Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int main(){
- cout.setf(ios_base::fixed);
- cout.precision(3);
- double ar[3][3] = {{0.2,0.5,2.1},
- {0.15,0.2,2.5},
- {0.9,5,2.7}};
- cout << "Enter number of data set\n";
- cout << "1, 2 or 3\n";
- int n;cin>>n;
- cout << "Enter x\n";
- double x; cin>>x;
- double a,b,z;
- switch (n)
- {
- case 1:
- a=ar[0][0];b=ar[0][1];z=ar[0][2];
- break;
- case 2:
- a=ar[1][0];b=ar[1][1];z=ar[1][2];
- break;
- case 3:
- a=ar[2][0];b=ar[2][1];z=ar[2][2];
- break;
- }
- if (x < -log(a))
- cout << a*sin(x)*sin(x)+b*cos(z*x);
- else if (-log(a) <= x && x <= b)
- cout << pow(a,b)-pow(cos(a+z*x),3);
- else if (x > b)
- cout << sqrt(2.5*pow(a,3)+pow(b-z*x*x,6));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement