Guest User

Untitled

a guest
Sep 13th, 2016
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. #include <iostream>
  2. #include <iomanip>
  3. using namespace std;
  4. int main()
  5. {
  6. int a, b, A, B, Z;
  7. float x, y;
  8.  
  9. //y = ax + b
  10. //y = Ax + B
  11. //cout << "Задайте уравнения прямых: укажите коэффициенты (a, b) для у = ax + b" << endl << "Для первой прямой:" << endl;
  12. cout<<"Enter the equation for a straight line. Enter the coefficients ( a, b ​​) for y = ax + b"<<endl<<"For the first line:"<<endl;
  13. cin >> a;
  14. cin >> b;
  15. //cout << "Для второй прямой:" << endl;
  16. cout<<"For the second line:"<<endl;
  17. cin >> A;
  18. cin >> B;
  19. Z = a - A;
  20. if (Z == 0)
  21. {
  22. //cout << "Нет точек пересечения прямых, прямые параллельны.";
  23. cout<<"There are no points of intersection. Straight parallel.";
  24. cin.get();
  25. cin.get();
  26. return 0;
  27. }
  28. else
  29. {
  30. x = (B - b) / (a - A);
  31. y = a*x + b;
  32. //cout << "Точкой пересечения прямых является (" << fixed << setprecision(1) << x << ", " << fixed << setprecision(1) << y << ").";
  33. cout<<"Intersection point of the line is ("<<fixed<<setprecision(1)<<x<<", "<<fixed<<setprecision(1)<<y<<").";
  34. cin.get();
  35. cin.get();
  36. }
  37. return 0;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment