#include "stdafx.h"
#include
#include
struct coord
{
double x;
double y;
};
using namespace std;
void TriangleExist(coord a, coord b, coord c)
{
double modAB = sqrt(pow((a.x-b.x),2)+pow((a.y-b.y),2));
double modAC = sqrt(pow((a.x-c.x),2)+pow((a.y-c.y),2));
double modBC = sqrt(pow((b.x-c.x),2)+pow((b.y-c.y),2));
if (modAB+modAC <= modBC)<br> cout << "Do not exist" << endl;<br> else if (modAC + modBC <= modAB)<br> cout << "Do not exist" << endl;<br> else if (modAB+modBC <= modAC)<br> cout << "Do not exist" << endl;<br> else
cout << "Exist" << endl;<br>}
int main()
{
coord A, B, C;
cin >> A.x >> A.y;
cin >> B.x >> B.y;
cin >> C.x >> C.y;
TriangleExist(A, B, C);
system("pause");
exit(0);
return 0;
}
Еще способ с чистым мейном.
#include
#include
#include //математическая библия, ну очень облегчает задачу :)))
using namespace std;
void main(void)
{
double Ax, Ay, Bx, By, Cx, Cy;
cin >> Ax >> Ay >> Bx >> By >> Cx >> Cy;
double modAB = sqrt(pow((Ax-Bx),2)+pow((Ay-By),2));
double modAC = sqrt(pow((Ax-Cx),2)+pow((Ay-Cy),2));
double modBC = sqrt(pow((Bx-Cx),2)+pow((By-Cy),2));
if (modAB+modAC <= modBC)<br> cout << "Do not exist" << endl;<br> else if (modAC + modBC <= modAB)<br> cout << "Do not exist" << endl;<br> else if (modAB+modBC <= modAC)<br> cout << "Do not exist" << endl;<br> else
cout << "Exist" << endl;<br> _getch();
return;
}