Advertisement
Guest User

Сравнение коээфициентов

a guest
Nov 1st, 2014
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.51 KB | None | 0 0
  1. #include <iostream>
  2. bool compare(int k1, int k2) {
  3.     bool res;
  4.     if (k1 == k2) res = true;
  5.     else res = false;
  6.     return res; }
  7.  
  8. int main() {
  9.     int x1,x2,x3,x4,y1,y2,y3,y4, k1, k2, b1,b2;
  10.     bool res, res2;
  11.     std::cin >> x1 >> y1 >> x2 >> y2;
  12.     std::cin >> x3 >> y3 >> x4 >> y4;
  13.     k1 = (y1-y2)*(x3-x4);
  14.     k2 = (y3-y4)*(x1-x2);
  15.     b1 = (x3 - x4)*(y1*(x1 - x2) - x1*(y1 - y2));
  16.     b2 = (x1 - x2)*(y3*(x3 - x4) - x3*(y3 - y4));
  17.     res = compare(k1, k2);
  18.     res2 = compare(b1, b2);
  19.     std::cout << res <<' ' << res2;
  20.     return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement