Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- double rast(int x1, int y1, int x2, int y2){
- return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
- }
- int main() {
- double x1, y1, x2, y2, x3, y3,a,b,c,p=0;
- cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
- a = rast(x1, y1, x2, y2);
- b = rast(x2, y2, x3, y3);
- c = rast(x1, y1, x3, y3);
- p = (a + b + c) / 2;
- cout << sqrt(p*(p - a)*(p - b)*(p - c));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement