Está en la página 1de 2

using namespace std;

#include <iostream>
#include <cstdlib>
#include <math.h>

struct Punto
{
int x;
int y;
};

int main(int argc, char** argv)
{
Punto P[4];
int i,la,lb,lc;

for (i=0;i<4;i++)
{

cout<<"Ingrese la coordenada x del punto P["<<i+1<<"]--> ";cin>>P[i].x;
cout<<"Ingrese la coordenada y del punto P["<<i+1<<"]-->
";cin>>P[i].y;;cout<<endl;
}
if((P[0].x==P[1].x)&&(P[1].x==P[2].x)&&(P[2].x==P[3].x))
{cout<<"Los puntos forman una recta"<<endl;}
else
{cout<<"Los puntos forman una figura"<< endl;}
if((P[0].y==P[1].y)&&(P[1].y==P[2].y)&&(P[2].y==P[3].y))
{cout<<"Los puntos forman una recta"<<endl;}
else
{cout<<"Los puntos forman una figura"<< endl;}
la=sqrt((pow((P[1].x-P[0].x),2)+pow((P[1].x-P[0].x),2)));
lb=sqrt((pow((P[2].x-P[0].x),2)+pow((P[2].x-P[0].x),2)));
lc=sqrt((pow((P[3].x-P[1].x),2)+pow((P[3].x-P[1].x),2)));

if(la==lb)
{
cout<<"Los puntos Forman una figura Cuadrada "<<endl;
}
if((la!=lb)&&(lb==lc))
{
cout<<"Los puntos forman una figura Rectangular"<<endl;
}
else
{
cout<<"Los puntos Forman un cuadrilatero "<<endl;
}
system("PAUSE");
return EXIT_SUCCESS;

}

También podría gustarte