Advertisement
tumaryui

Untitled

May 28th, 2020
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. // y = a * (x - b) * sin(d/(x - c))
  2. // график построен для коэффициентов a = d = 1 | b = c = 0
  3. #include <iostream>
  4. #include <fstream>
  5. using namespace std;
  6. const double eps = 0.01;
  7.  
  8. double a, b, c, d;
  9.  
  10. double f(double x) {
  11. return a * (x - b) * sin(d / (x - c));
  12. }
  13. main() {
  14.  
  15. // вывод в файл
  16. ofstream foutx, fouty;
  17. foutx.open("x.txt");
  18. fouty.open("y.txt");
  19.  
  20. cout << fixed;
  21. cout.precision(12);
  22. puts("Graph : y = a * (x - b) * sin(d / (x - c))\n Enter a, b, c, d:");
  23. cin >> a >> b >> c >> d;
  24. for(double x = -3; x <= 3; x += eps) {
  25. double y = f(x);
  26. foutx << x << endl;
  27. fouty << y << endl;
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement