Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<cmath>
- using namespace std;
- double branch(double x, double b, double c){
- double d = 0;
- if(x>=0 && x<=1){
- d = cos(1-(c*pow(x,2)/b));
- if(d < pow(sin(x), 2)){
- d = pow(sin(x), 2);
- }
- }
- else{
- if( x > 1){
- d = c;
- if(d < x){
- d = x;
- }
- double d1 = sqrt(x);
- if(d1 > sqrt(b) + c){
- d1 = sqrt(b) + c;
- }
- if(d < d1){
- d = d1;
- }
- }
- else{
- d = exp(b*x+c);
- }
- }
- return d;
- }
- int main(){
- double x, b, c, d;
- cin >> x >> b >> c;
- d = branch(x,b,c);
- cout << d;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement