Advertisement
Kacper_Michalak

Zadanie funkcje 14 i 15

Feb 1st, 2021
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.43 KB | None | 0 0
  1.  
  2. #include <iostream>
  3. #include <math.h>
  4. using namespace std;
  5.  
  6. int POLE_TROJKATA(int x, int h)
  7. {
  8.     int wynik = 0;
  9.     wynik = (x * h)/2;
  10.    
  11.     return wynik;
  12. }
  13.  
  14. int POLE_TROJKATA(int x1, int y1, int x2, int y2, int x3, int y3)
  15. {
  16.     int P;
  17.  
  18.     P = (abs((x2 - x1) * (y3 - y1) - (y2 - y1) * (x3 - x1)))/2;
  19.     return P;
  20. }
  21.  
  22. int main()
  23. {
  24.     cout << POLE_TROJKATA(6, 2) << endl;
  25.  
  26.     cout << POLE_TROJKATA(2, 1, -5, 4, -1, -2) << endl;
  27.  
  28.  
  29. }
  30.  
  31.  
  32.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement