Aleksandr_Grigoryev

06.12.2017 HW 7,a

Dec 6th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.72 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. void Intersection(int a1, int b1, int c1, int a2, int b2, int c2)
  4. {
  5.     if (((a1 == 0) && (b1 == 0)) || ((a2 == 0)&&(b2 == 0)))
  6.         cout << "there is no such direct";
  7.     else if ((a1 / a2) == (b1 / b2)&&((a1 / a2) == (c1 / c2)))
  8.         cout << "   Straight lines coincide";
  9.     else if ((a1 / a2) == (b1 / b2)&&((b1 / b2) != (c1 / c2)))
  10.         cout << "parallel";
  11.     else if ((a1 / a2) != (b1 / b2))
  12.     {
  13.         cout << "intersect";
  14.         cout << (-1)*(c1*b2 - c2*b1) / (a1*b2 - a2*b1) <<' '<< (-1)*(c2*a1 - c1*a2) / (a1*b2 - a2*b1);
  15.     }
  16. }
  17.     int main ()
  18.     {
  19.         int a1,a2,b1,b2,c1,c2;
  20.         cin >> a1 >> b1 >> c1;
  21.         cin >> a2 >> b2 >> c2;
  22.      Intersection(a1, b1, c1, a2, b2, c2);
  23.      system("pause");
  24.      return 0;
  25.  
  26. }
Advertisement
Add Comment
Please, Sign In to add comment