Advertisement
Guest User

Untitled

a guest
Nov 14th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.04 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <iostream>
  3. #include <math.h>
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     int x1, y1, x2, y2, x3, y3;
  9.     cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
  10.     float a = sqrt(pow((x1 - x2), 2) + pow((y1 - y2), 2));
  11.     float b = sqrt(pow((x1 - x3), 2) + pow((y1 - y3), 2));
  12.     float c = sqrt(pow((x2 - x3), 2) + pow((y2 - y3), 2));
  13.    
  14.     bool istriangle = false;
  15.  
  16.     if ((a + b <= c) || (a + c <= b) || (c + b <= b)) {
  17.         cout << "Not triangle" << endl;
  18.     }
  19.     else {
  20.         cout << "Is triangle" << endl;
  21.         istriangle = true;
  22.     }
  23.     if (istriangle) {
  24.         if ((pow(a, 2) + pow(b, 2) == pow(c, 2)) ||
  25.             (pow(a, 2) + pow(c, 2) == pow(b, 2)) ||
  26.             (pow(c, 2) + pow(b, 2) == pow(a, 2))) {
  27.             cout << " = 90";
  28.         }
  29.         else if ((pow(a, 2) + pow(b, 2) > pow(c, 2)) ||
  30.             (pow(a, 2) + pow(c, 2) > pow(b, 2)) ||
  31.             (pow(c, 2) + pow(b, 2) > pow(a, 2))) {
  32.             cout << " < 90";
  33.         }
  34.         else if ((pow(a, 2) + pow(b, 2) < pow(c, 2)) ||
  35.             (pow(a, 2) + pow(c, 2) < pow(b, 2)) ||
  36.             (pow(c, 2) + pow(b, 2) < pow(a, 2))) {
  37.             cout << " > 90";
  38.         }
  39.     }
  40.     return 0;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement