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