Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- int main() {
- float x1, y1, x2, y2, x3, y3;
- cout << "Tochka 1 (x y): "; cin >> x1 >> y1;
- cout << "Tochka 2 (x y): "; cin >> x2 >> y2;
- cout << "Tochka 3 (x y): "; cin >> x3 >> y3;
- float a = sqrt((x2 - x3) * (x2 - x3) + (y2 - y3) * (y2 - y3));
- float b = sqrt((x1 - x3) * (x1 - x3) + (y1 - y3) * (y1 - y3));
- float c = sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
- if (a + b > c && a + c > b && b + c > a) {
- float P = a + b + c;
- float p = P / 2;
- float S = sqrt(p * (p - a) * (p - b) * (p - c));
- cout << "Perimetur: " << P << endl;
- cout << "Lice: " << S << endl;
- } else {
- cout << "Ne moje da ima triugulnik!" << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment