Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- class solution4
- {
- double a = 1.65;
- double h = 0.1;
- double case1(double xx)
- {
- return -3*xx*xx;
- }
- double case2(double xx)
- {
- return a * xx + 4 * sqrt(xx);
- }
- double case3(double xx)
- {
- return log(xx+4)*sqrt(xx+a);
- }
- public:
- void cMain()
- {
- double y;
- for(double x = 0.1; x < 2.1 ; x = x + h)
- {
- if(x<1.4) y = case1(x);
- else if(x==1.4) y = case2(x);
- else if(x>1.4) y = case3(x);
- cout << x << " " << y << endl;//OUTPUT ozunuz deyisin uygun formaya
- }
- }
- };
- //*************************************************************************
- class solution3
- {
- double a = 2.8;
- double h = 0.05;
- double b = 0.3;
- double case1(double xx)//x>1.3
- {
- return a * xx * xx + b * xx + a;
- }
- double case2(double xx)//x<1.2
- {
- return a / xx + sqrt(xx * xx + 1);
- }
- double case3(double xx)//1.2<=x<1.3
- {
- return (a + b * xx) * sqrt(xx * xx + 1);
- }
- public:
- void cMain()
- {
- double y;
- for(double x = 1; x <= 2.05 ; x = x + h)
- {
- if(x>1.3) y = case1(x);
- else if(x<1.2) y = case2(x);
- else if(x>=1.2 && x<=1.3) y = case3(x);
- cout << x << " " << y << endl;//OUTPUT ozunuz deyisin uygun formaya
- }
- }
- };
- //*************************************************************
- int main() {
- // solution4 a;
- //a.cMain();
- solution3 b;
- b.cMain();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement