Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <list>
- #include <algorithm>
- #include <cmath>
- #include <vector>
- using namespace std;
- struct Point
- {
- double x,y;
- };
- struct Line
- {
- double a,b,c;
- };
- void LineFromTwoPoints(Point a, Point b)
- {
- Line l;
- l.a = (b.y - a.y) / (b.x - a.x);
- l.b = 1;
- l.c = b.y - l.a * b.x;
- cout << "y = " << l.a << "x + " << l.c;
- }
- bool isPointOnLine(Point m, Line n)
- {
- return (n.a*m.x + n.b*m.y + n.c == 0);
- }
- int main()
- {
- Point m;
- Line n;
- cin >> m.x >> m.y >> n.a >> n.b >> n.c;
- cout << (isPointOnLine(m, n) ? "Yes\n" : "No\n");
- Point A, B;
- cin >> A.x >> A.y >> B.x >> B.y;
- LineFromTwoPoints(A,B);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement