Advertisement
medajibka

2.4 down

Apr 18th, 2022
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.67 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3.  
  4. using namespace std;
  5. double x;
  6. // int a, b, c;
  7.  
  8. void input() {
  9.     cout << "Enter x: ";
  10.     cin >> x;
  11. //    cout << "Enter a: ";
  12. //    cin >> a;
  13. //    cout << "Enter b: ";
  14. //    cin >> b;
  15. //    cout << "Enter c: ";
  16. //    cin >> c;
  17. }
  18.  
  19. double function(const double x) {
  20.     return (x + 1) - ((3 * x * x + 4) / x);
  21. }
  22.  
  23. int main() {
  24.  
  25.     input();
  26.  
  27. //    while (b < a) {
  28. //        cout << "Input range again:\n";
  29. //        input();
  30. //    }
  31.  
  32.     if (x == 0) {
  33.         cout << "\033[1;31mWhen x = 0 there is no solution\033[0m\n" << endl;
  34.     } else {
  35.         cout << "Result = " << function(x);
  36.     }
  37.  
  38.     return 0;
  39. }
  40.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement