Advertisement
Guest User

Untitled

a guest
Oct 18th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <cmath>
  4. #include <iomanip>
  5. #include <vector>
  6. using namespace std;
  7. int main() { int x, f, xn, xk, dx, i, d, z;
  8. double a, b , c , F;
  9. cout « "ENTER a" « endl;
  10. cin » a;
  11. cout « "ENTER b" « endl;
  12. cin » b;
  13. cout « "ENTER c" « endl;
  14. cin » c;
  15. cout « "ENTER x" « endl;
  16. cin » x;
  17. cout « "ENTER xn" « endl;
  18. cin » xn;
  19. cout « "ENTER xk" « endl;
  20. cin » xk;
  21. cout « "ENTER dx" « endl;
  22. cin » dx;
  23. d = abs((xk+1)-xn);
  24. z = dx;
  25. vector <int> m(d);
  26. for (i = 1; i <= d; i++) { m[i] = xn; xn++;}
  27. if ((a*(b+c))==0)
  28. {for (i = 1; i <= d; i += z) { if (c < 0 and b!= 0) {f = a * (pow(m[i],2)) + (pow(b,2)) * m[i];}
  29. else if (c > 0 and b == 0) {f = ((m[i]+a)/(m[i]+c));}
  30. else {f=(m[i]/c);}
  31. cout « setw(10) « "|" « "f=" « f « endl;};}
  32. if ((a*(b+c))!=0)
  33. {for (i = 1; i <= d; i += z ) { if (c < 0 and b!= 0) {F = a * (pow(m[i],2)) + (pow(b,2)) * m[i];}
  34. else if (c > 0 and b == 0) {F = ((m[i]+a)/(m[i]+c));}
  35. else {F=(m[i]/c);}
  36. cout « setw(10) « "|" « "F=" « F « endl;};};}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement