Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void Intersection(int a1, int b1, int c1, int a2, int b2, int c2)
- {
- if (((a1 == 0) && (b1 == 0)) || ((a2 == 0)&&(b2 == 0)))
- cout << "there is no such direct";
- else if ((a1 / a2) == (b1 / b2)&&((a1 / a2) == (c1 / c2)))
- cout << " Straight lines coincide";
- else if ((a1 / a2) == (b1 / b2)&&((b1 / b2) != (c1 / c2)))
- cout << "parallel";
- else if ((a1 / a2) != (b1 / b2))
- {
- cout << "intersect";
- cout << (-1)*(c1*b2 - c2*b1) / (a1*b2 - a2*b1) <<' '<< (-1)*(c2*a1 - c1*a2) / (a1*b2 - a2*b1);
- }
- }
- int main ()
- {
- int a1,a2,b1,b2,c1,c2;
- cin >> a1 >> b1 >> c1;
- cin >> a2 >> b2 >> c2;
- Intersection(a1, b1, c1, a2, b2, c2);
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment