Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <iostream>
- #include <math.h>
- using namespace std;
- int main()
- {
- int x1, y1, x2, y2, x3, y3;
- cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
- float a = sqrt(pow((x1 - x2), 2) + pow((y1 - y2), 2));
- float b = sqrt(pow((x1 - x3), 2) + pow((y1 - y3), 2));
- float c = sqrt(pow((x2 - x3), 2) + pow((y2 - y3), 2));
- bool istriangle = false;
- if ((a + b <= c) || (a + c <= b) || (c + b <= b)) {
- cout << "Not triangle" << endl;
- }
- else {
- cout << "Is triangle" << endl;
- istriangle = true;
- }
- if (istriangle) {
- if ((pow(a, 2) + pow(b, 2) == pow(c, 2)) ||
- (pow(a, 2) + pow(c, 2) == pow(b, 2)) ||
- (pow(c, 2) + pow(b, 2) == pow(a, 2))) {
- cout << " = 90";
- }
- else if ((pow(a, 2) + pow(b, 2) > pow(c, 2)) ||
- (pow(a, 2) + pow(c, 2) > pow(b, 2)) ||
- (pow(c, 2) + pow(b, 2) > pow(a, 2))) {
- cout << " < 90";
- }
- else if ((pow(a, 2) + pow(b, 2) < pow(c, 2)) ||
- (pow(a, 2) + pow(c, 2) < pow(b, 2)) ||
- (pow(c, 2) + pow(b, 2) < pow(a, 2))) {
- cout << " > 90";
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement