Advertisement
Guest User

Untitled

a guest
Dec 13th, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. #include <iostream>
  2. #include <iomanip>
  3. using namespace std;
  4. int main() {
  5. double a, b, h, y;
  6. double eps = 1e-12;
  7. cin >> a >> b >> h;
  8. for (double i = a; i < b + eps; i += h) {
  9. cout << fixed << setprecision(6) << i << '\t';
  10. if (abs(abs(i) - 1) < eps) cout << "undefined" << endl;
  11. else cout << fixed << setprecision(6) << 1 / (i * i - 1) << endl;
  12. }
  13. return 0;
  14. }
  15.  
  16.  
  17.  
  18.  
  19. /*
  20. struct point {
  21. int x, y, z;
  22. };
  23. int perimetr(point a, point b, point c) {
  24. double ot1, ot2, ot3, p;
  25. ot1 = sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y) + (a.z - b.z) * (a.z - b.z));
  26. ot2 = sqrt((b.x - c.x) * (b.x - c.x) + (b.y - c.y) * (b.y - c.y) + (b.z - c.z) * (b.z - c.z));
  27. ot3 = sqrt((a.x - c.x) * (a.x - c.x) + (a.y - c.y) * (a.y - c.y) + (a.z - c.z) * (a.z - c.z));
  28. p = ot1 + ot2 + ot3;
  29. return p;
  30. }
  31. int main() {
  32. int n, p;
  33. double m_p = 1e9;
  34. setlocale(LC_ALL, "Russian");
  35. cout << "Количество точек >> ";
  36. cin >> n;
  37. vector <point> toch;
  38. for (int i = 0; i < n; i++) {
  39. cout << "Введите координаты точки\n x = ";
  40. cin >> toch[i].x; // здесь ошибка
  41. cout << "y = ";
  42. cin >> toch[i].y;
  43. cout << "z = ";
  44. cin >> toch[i].z;
  45. }
  46. for (int i = 0; i < n - 2; i++) {
  47. for (int j = i + 1; i < n - 1; i++) {
  48. for (int k = j + 1; k < n; k++) {
  49. p = perimetr(toch[i], toch[j], toch[k]);
  50. if (m_p < p) m_p = p;
  51. }
  52. }
  53. }
  54. cout << m_p;
  55. }*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement