Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <iomanip>
- using namespace std;
- int main()
- {
- int a, b, A, B, Z;
- float x, y;
- //y = ax + b
- //y = Ax + B
- //cout << "Задайте уравнения прямых: укажите коэффициенты (a, b) для у = ax + b" << endl << "Для первой прямой:" << endl;
- cout<<"Enter the equation for a straight line. Enter the coefficients ( a, b ) for y = ax + b"<<endl<<"For the first line:"<<endl;
- cin >> a;
- cin >> b;
- //cout << "Для второй прямой:" << endl;
- cout<<"For the second line:"<<endl;
- cin >> A;
- cin >> B;
- Z = a - A;
- if (Z == 0)
- {
- //cout << "Нет точек пересечения прямых, прямые параллельны.";
- cout<<"There are no points of intersection. Straight parallel.";
- cin.get();
- cin.get();
- return 0;
- }
- else
- {
- x = (B - b) / (a - A);
- y = a*x + b;
- //cout << "Точкой пересечения прямых является (" << fixed << setprecision(1) << x << ", " << fixed << setprecision(1) << y << ").";
- cout<<"Intersection point of the line is ("<<fixed<<setprecision(1)<<x<<", "<<fixed<<setprecision(1)<<y<<").";
- cin.get();
- cin.get();
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment