mramine364

Triangle Area

Aug 26th, 2016
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.30 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3.  
  4. using namespace std;
  5.  
  6. double tArea(double ax,double ay,double bx,double by,double cx,double cy)
  7. {
  8.     double t=abs( (ax-cx)*(by-ay)-(ax-bx)*(cy-ay) )/2;
  9.     return t;
  10. }
  11. int main()
  12. {
  13.    cout << tArea(20,10,20,50,50,10) << endl; // 600
  14.    
  15.    return 0;
  16. }
Advertisement
Add Comment
Please, Sign In to add comment