Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // y = a * (x - b) * sin(d/(x - c))
- // график построен для коэффициентов a = d = 1 | b = c = 0
- #include <iostream>
- #include <fstream>
- using namespace std;
- const double eps = 0.01;
- double a, b, c, d;
- double f(double x) {
- return a * (x - b) * sin(d / (x - c));
- }
- main() {
- // вывод в файл
- ofstream foutx, fouty;
- foutx.open("x.txt");
- fouty.open("y.txt");
- cout << fixed;
- cout.precision(12);
- puts("Graph : y = a * (x - b) * sin(d / (x - c))\n Enter a, b, c, d:");
- cin >> a >> b >> c >> d;
- for(double x = -3; x <= 3; x += eps) {
- double y = f(x);
- foutx << x << endl;
- fouty << y << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement