Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- float f(float x)
- {
- if (fabs(x) < 2) return sqrt(5 * pow(x, 2) + 5);
- else if ((fabs(x) >= 2) && (fabs(x) <= 10)) return fabs(x) / sqrt(5 * pow(x, 2) + 5);
- else return 0;
- }
- int main()
- {
- float a, b, h, x;
- cout << "a="; cin >> a;
- cout << "b="; cin >> b;
- cout << "h="; cin >> h;
- cout << "x\tf(x)\n";
- for (x = a; x <= b; x += h)
- cout << x << "\t" << f(x) << endl;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment