Sei sulla pagina 1di 2

/////////////Ejercicio Trapeco//////////////

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

using namespace std;

class TRAPECIO
{
private:
float BMA;
float BME;
float ALT;
float VOL;
public:
TRAPECIO(float B,float C,float H);
void TIPO_TRAPECIO();
void CALCULO_AREA();
void PERIMETRO();
void VOLUMEN();
void MOSTRAR();
};
TRAPECIO::TRAPECIO(float B,float C,float H)
{
BMA=B;
BME=C;
ALT=H;
}
void TRAPECIO::TIPO_TRAPECIO()
{
int ang1,ang2,ang3,ang4;
cout<<"\n ingrese el angulo a:";
cin>>ang1;
cout<<"\n ingrese el angulo B:";
cin>>ang2;
cout<<"\n ingrese el angulo C:";
cin>>ang3;
cout<<"\n ingrese el angulo D:";
cin>>ang4;
if(ang1!=ang2 && ang3!=ang4&&ang4!=ang1)
cout<<"\n Es un Trapecio Escaleno"<<endl;
else
{
if(ang1==ang2 && ang3==ang4)
cout<<"\n Forman un trapecio Issceles"<<endl;
else
{
if(ang1==90 && ang2==90 && ang3!=90 && ang4!=90)
cout<<"\n Forman un trapecio Rectngulo"<<endl;
}
}
}
void TRAPECIO::CALCULO_AREA()
{
float AREA;
AREA=((BMA+BME)*ALT)/2;
cout<<"El Area del Trapecio es: "<<AREA<<"\n";
}
void TRAPECIO::PERIMETRO()
{
float PER;
PER=BMA+BME+ALT;
cout<<"El Perimetro del Trapecio es: "<<PER<<"\n";
}
void TRAPECIO::VOLUMEN()
{
float VOL;
VOL=(BMA+BME+sqrt(BMA*BME))*ALT/3;
cout<<"El Volumen del Trapecio es: "<<VOL<<endl;
}
void TRAPECIO::MOSTRAR()
{
cout<<"La Base Mayor del Trapecio es: "<<BMA<<endl;
cout<<"La Base Menor del Trapecio es: "<<BME<<endl;
cout<<"LA Altura del Trapecio es: "<<ALT<<endl;
}
int main()
{
float BM,BN,AL;
cout<<"Introduzca la Base Mayor: ";
cin>>BM;
cout<<"Introduzca la Base Menor: ";
cin>>BN;
cout<<"Introduzca la Altura: ";
cin>>AL;

TRAPECIO R(BM,BN,AL);
R.TIPO_TRAPECIO();
R.CALCULO_AREA();
R.PERIMETRO();
R.VOLUMEN();
R.MOSTRAR();
}

Potrebbero piacerti anche