Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- double a, b;
- double function(const double x) {
- return (x + 1) - ((3 * x * x + 4) / x);
- }
- void input() {
- cout << "Enter a: ";
- cin >> a;
- cout << "Enter b: ";
- cin >> b;
- }
- int main() {
- input();
- while (b < a) {
- cout << "Input range again:\n";
- input();
- }
- for (double i = a; i <= b; i++) {
- if (i == 0) {
- cout << "\033[1;31mWhen x = 0 there is no solution;\033[0m\n";
- } else {
- cout << "X = " << i << "; Y = " << function(i) << ";\n";
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement