daily pastebin goal
63%
SHARE
TWEET

Untitled

a guest Mar 25th, 2019 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2.  
  3. float rasp(x1, y1, x2, y2, xa, ya)
  4. {
  5.     float k = (x2 - x1) * (ya - y1) - (xa - x1) * (y2 - y1);
  6.     if (k > 0)
  7.         k = 0;
  8.     else
  9.     {
  10.         if (k == 0)
  11.             k = 1;
  12.         else
  13.             k = 2;
  14.     }
  15.     return k;
  16. }
  17.  
  18. int main()
  19. {
  20.     int rc;
  21.     float x1, y1, x2, y2, xa, ya;
  22.     printf("Введите координаты: ");
  23.     rc = scanf("%f%f%f%f%f%f", &x1, &y1, &x2, &y2, &xa, &ya);
  24.     if (rc != 6 || x1 == x2 || y1 == y2)
  25.     {
  26.         printf("Неверный ввод!\n");
  27.         return 1;
  28.     }
  29.     else
  30.     {
  31.         int k = rasp(x1, y1, x2, y2, xa, ya);
  32.         printf("%d\n", k);
  33.     }
  34.     return 0;
  35. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top