Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- int main()
- {
- float x1, x2, x3, y1, y2, y3, p, a, b, c, h1, h2, h3;
- cout << "Enter coordinates: \n";
- cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
- a = sqrt(pow((x2-x1),2)+pow((y2-y1),2));
- b = sqrt(pow((x3-x2),2)+pow((y3-y2),2));
- c = sqrt(pow((x1-x3),2)+pow((y1-y3),2));
- if (a + b > c && b + c > a && a + c > b)
- {
- if (pow(a, 2) + pow(b, 2) == pow(c, 2) || pow(b,2) + pow (c,2) == pow(a, 2) || pow(a, 2) + pow(c, 2) == pow(b, 2))
- cout << "Right angled triangle";
- else if (
- (pow(a, 2) - pow(b, 2) - pow(c, 2)) / ((-2)*b*c) > 0 &&
- (pow(b, 2) - pow(c, 2) - pow(a, 2)) / ((-2)*a*c) > 0 &&
- (pow(c, 2) - pow(a, 2) - pow(b, 2)) / ((-2)*a*b) > 0
- )
- cout << "Acute-angled triangle\n";
- else cout << "Obtuse-angled triangle\n";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement