Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- #include <cmath>
- #include <algorithm>
- using namespace std;
- void print_f1(double a, double b)
- {
- double step = (b - a + 1) / 10.0;
- cout << endl;
- cout << "Function 1: y = 5x + 16" << endl;
- double x = a;
- while (x <= b)
- {
- cout << fixed;
- cout << setprecision(3) << "X = " << x << " Y = " << 5 * x + 16 << endl;
- x += step;
- }
- }
- void print_f2(double a, double b)
- {
- double step = (b - a) / 9.0;
- cout << endl;
- cout << "Function 2: y = sin(8x)" << endl;
- double x = a;
- while (x <= b)
- {
- cout << fixed;
- cout << setprecision(3) << "X = " << x << " Y = " << sin(8 * x) << endl;
- x += step;
- }
- }
- int main()
- {
- double a, b;
- cout << "Enter interval limits [a, b] : " << endl;
- cin >> a >> b;
- print_f1(a, b);
- print_f2(a, b);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement