Advertisement
Guest User

Untitled

a guest
Nov 24th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.79 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     double xn,xk,dx, a,b,c;
  9.     cin >> xn >> xk >> dx >> a >> b >> c ;
  10.     if(int(a) & int(c) | (int(b) | int(c)) != 0) {
  11.         for(double x = xn; x <= xk; x += dx) {
  12.             double f;
  13.             if(x + 5 < 0 && c == 0) f = (1/a*x)-b;
  14.             else if(x + 5 > 0 && c != 0) f = (x-a)/x;
  15.             else f = (10*x)/(c-4);
  16.             cout << "x = " << x << "\tf = " << f << endl;
  17.         }  
  18.     }
  19.     else {
  20.         for(double x = xn; x <= xk; x += dx) {
  21.             int f;
  22.             if(x + 5 < 0 && c == 0) f = (1/a)-b;
  23.             else if(x + 5 > 0 && c != 0) f = (x-a)/x;
  24.             else f = (10*x)/(c-4);
  25.             cout << "x = " << x << "\tf = " << f << endl;
  26.         }
  27.     }
  28.     return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement