===========================================================================
CODING
#include<iostream.h>
#include<conio.h>
#include<math.h>
void main()
{
clrscr();
float a1,a2,b1,b2,c1,c2,d1,d2,s1,s2,s3,s4,Ar,Ar1,Ar2,D1,D2,m1,m2,m3,m4;
cout<<"Want to Find type of Quadrilateral:- \n\n¯Enter the co-ordinates of point A:- \n Enter x co-ordinate: ";
cin>>a1;
cout<<"\n Enter y co-ordinate: ";
cin>>a2;
cout<<"\n\n¯Enter the co-ordinates of point B:- \n Enter x co-ordinate: ";
cin>>b1;
cout<<"\n Enter y co-ordinate: ";
cin>>b2;
cout<<"\n\n¯Enter the co-ordinates of point C:- \n Enter x co-ordinate: ";
cin>>c1;
cout<<"\n Enter y co-ordinate: ";
cin>>c2;
cout<<"\n\n¯Enter the co-ordinates of point D:- \n Enter x co-ordinate: ";
cin>>d1;
cout<<"\n Enter y co-ordinate: ";
cin>>d2;
Ar1=0.5*abs(a1*(b2-c2)+b1*(c2-a2)+c1*(a2-b2));
Ar2=0.5*abs(a1*(d2-c2)+d1*(c2-a2)+c1*(a2-d2));
Ar=Ar1+Ar2;
s1=sqrt(pow(b1-a1,2)+pow(b2-a2,2));
s2=sqrt(pow(c1-b1,2)+pow(c2-b2,2));
s3=sqrt(pow(d1-c1,2)+pow(d2-c2,2));
s4=sqrt(pow(a1-d1,2)+pow(a2-d2,2));
D1=sqrt(pow(c1-a1,2)+pow(c2-a2,2));
D2=sqrt(pow(d1-b1,2)+pow(d2-b2,2));
m1=(b2-a2)/(b1-a1);
m2=(c2-b2)/(c1-b1);
m3=(d2-c2)/(d1-c1);
m4=(a2-d2)/(a1-d1);
if(Ar==0)
{
cout<<"\nThe points do not form a Quadrilateral but are colliner points as area="<<Ar;}
else
{
if(s1==s3 && s2==s4 && s1!=s2 && m1==m3 && m2==m4)
{
cout<<"\nThe points form a Paralalogram with area="<<Ar<<" And sides="<<s1<<", "<<s2<<", "<<s3<<", "<<s4<<" And Diagonals="<<D1<<", "<<D2;}
else if(s1==s3 && s2==s4 && s1==s2 && D1!=D2 && m1==m3 && m2==m4)
{
cout<<"\nThe points form a Rhombus with area="<<Ar<<" And sides="<<s1<<", "<<s2<<", "<<s3<<", "<<s4<<" And Diagonals="<<D1<<", "<<D2;}
else if(s1==s3 && s2==s4 && s1==s2 && D1==D2 && m1==m3 && m2==m4)
{
cout<<"\nThe points form a Square with area="<<Ar<<" And sides="<<s1<<", "<<s2<<", "<<s3<<", "<<s4<<" And Diagonals="<<D1<<", "<<D2;}
else if(s1==s3 && s2==s4 && s1!=s2 && D1==D2 && m1==m3 && m2==m4)
{
cout<<"\nThe points form a Rectangle with area="<<Ar<<" And sides="<<s1<<", "<<s2<<", "<<s3<<", "<<s4<<" And Diagonals="<<D1<<", "<<D2;}
else if(s1!=s3 && m1==m3)
{if (s2==s4)
{cout<<"\nThe points form a isoceles Trapezium with area="<<Ar<<" And sides="<<s1<<", "<<s2<<", "<<s3<<", "<<s4<<" And Diagonals="<<D1<<", "<<D2;}
else
{cout<<"\nThe points form a Trapezium with area="<<Ar<<" And sides="<<s1<<", "<<s2<<", "<<s3<<", "<<s4;}
}
else if(s2!=s4 && m2==m4)
{if (s1==s3)
{cout<<"\nThe points form a isoceles Trapezium with area="<<Ar<<" And sides="<<s1<<", "<<s2<<", "<<s3<<", "<<s4<<" And Diagonals="<<D1<<", "<<D2;}
else
{cout<<"\nThe points form a Trapezium with area="<<Ar<<" And sides="<<s1<<", "<<s2<<", "<<s3<<", "<<s4;}
}
else
{cout<<"\nThe points form a Random Quadrilataral with area="<<Ar<<" And sides="<<s1<<", "<<s2<<", "<<s3<<", "<<s4<<" And Diagonals="<<D1<<", "<<D2;}
}
getch();
}
CODING
#include<iostream.h>
#include<conio.h>
#include<math.h>
void main()
{
clrscr();
float a1,a2,b1,b2,c1,c2,d1,d2,s1,s2,s3,s4,Ar,Ar1,Ar2,D1,D2,m1,m2,m3,m4;
cout<<"Want to Find type of Quadrilateral:- \n\n¯Enter the co-ordinates of point A:- \n Enter x co-ordinate: ";
cin>>a1;
cout<<"\n Enter y co-ordinate: ";
cin>>a2;
cout<<"\n\n¯Enter the co-ordinates of point B:- \n Enter x co-ordinate: ";
cin>>b1;
cout<<"\n Enter y co-ordinate: ";
cin>>b2;
cout<<"\n\n¯Enter the co-ordinates of point C:- \n Enter x co-ordinate: ";
cin>>c1;
cout<<"\n Enter y co-ordinate: ";
cin>>c2;
cout<<"\n\n¯Enter the co-ordinates of point D:- \n Enter x co-ordinate: ";
cin>>d1;
cout<<"\n Enter y co-ordinate: ";
cin>>d2;
Ar1=0.5*abs(a1*(b2-c2)+b1*(c2-a2)+c1*(a2-b2));
Ar2=0.5*abs(a1*(d2-c2)+d1*(c2-a2)+c1*(a2-d2));
Ar=Ar1+Ar2;
s1=sqrt(pow(b1-a1,2)+pow(b2-a2,2));
s2=sqrt(pow(c1-b1,2)+pow(c2-b2,2));
s3=sqrt(pow(d1-c1,2)+pow(d2-c2,2));
s4=sqrt(pow(a1-d1,2)+pow(a2-d2,2));
D1=sqrt(pow(c1-a1,2)+pow(c2-a2,2));
D2=sqrt(pow(d1-b1,2)+pow(d2-b2,2));
m1=(b2-a2)/(b1-a1);
m2=(c2-b2)/(c1-b1);
m3=(d2-c2)/(d1-c1);
m4=(a2-d2)/(a1-d1);
if(Ar==0)
{
cout<<"\nThe points do not form a Quadrilateral but are colliner points as area="<<Ar;}
else
{
if(s1==s3 && s2==s4 && s1!=s2 && m1==m3 && m2==m4)
{
cout<<"\nThe points form a Paralalogram with area="<<Ar<<" And sides="<<s1<<", "<<s2<<", "<<s3<<", "<<s4<<" And Diagonals="<<D1<<", "<<D2;}
else if(s1==s3 && s2==s4 && s1==s2 && D1!=D2 && m1==m3 && m2==m4)
{
cout<<"\nThe points form a Rhombus with area="<<Ar<<" And sides="<<s1<<", "<<s2<<", "<<s3<<", "<<s4<<" And Diagonals="<<D1<<", "<<D2;}
else if(s1==s3 && s2==s4 && s1==s2 && D1==D2 && m1==m3 && m2==m4)
{
cout<<"\nThe points form a Square with area="<<Ar<<" And sides="<<s1<<", "<<s2<<", "<<s3<<", "<<s4<<" And Diagonals="<<D1<<", "<<D2;}
else if(s1==s3 && s2==s4 && s1!=s2 && D1==D2 && m1==m3 && m2==m4)
{
cout<<"\nThe points form a Rectangle with area="<<Ar<<" And sides="<<s1<<", "<<s2<<", "<<s3<<", "<<s4<<" And Diagonals="<<D1<<", "<<D2;}
else if(s1!=s3 && m1==m3)
{if (s2==s4)
{cout<<"\nThe points form a isoceles Trapezium with area="<<Ar<<" And sides="<<s1<<", "<<s2<<", "<<s3<<", "<<s4<<" And Diagonals="<<D1<<", "<<D2;}
else
{cout<<"\nThe points form a Trapezium with area="<<Ar<<" And sides="<<s1<<", "<<s2<<", "<<s3<<", "<<s4;}
}
else if(s2!=s4 && m2==m4)
{if (s1==s3)
{cout<<"\nThe points form a isoceles Trapezium with area="<<Ar<<" And sides="<<s1<<", "<<s2<<", "<<s3<<", "<<s4<<" And Diagonals="<<D1<<", "<<D2;}
else
{cout<<"\nThe points form a Trapezium with area="<<Ar<<" And sides="<<s1<<", "<<s2<<", "<<s3<<", "<<s4;}
}
else
{cout<<"\nThe points form a Random Quadrilataral with area="<<Ar<<" And sides="<<s1<<", "<<s2<<", "<<s3<<", "<<s4<<" And Diagonals="<<D1<<", "<<D2;}
}
getch();
}
===========================================================================
No comments:
Post a Comment