
LABORATORIO 2
FUNCIONES
CLICK AQUI
#include <iostream>
#include<math.h>
using namespace std;
double R,R1,R2,Q;
int x,y,b,e,base,v,t,m;
double HIPERBOLA (int a);
double RADICAL (int x ,int y);
double CAPACITANCIA (int x , int y);
double INDUCTANCIA (int x , int y);
int main()
{int opcion;
do
{cout<<"MENU \n";
cout<<" 1.- hiperbola \n";
cout<<" 2.- radicacion \n";
cout<<" 3.- Potencia capacitiva \n";
cout<<" 4.- Potencia inductiva \n";
cout<<"ingrese opcion : \n";
cin>>opcion;
switch (opcion)
{
case 1:
{
cout<<"Hiperbola"<<endl;
cout<<"Ingrese la variable:"; cin>>x;
R=HIPERBOLA(x);
cout<<"la hiperbola es: " ; cout<<R<<endl;
};break;
case 2:
{
cout<<"RADICAL"<<endl;
cout<<"Ingrese la base"; cin>>b;
cout<<"Ingrese elmaximo"; cin>>m;
cout<<"Ingrese el exponente" ; cin>>e;
base=1;
R=RADICAL(b,e);
cout<<"el radical es" ; cout<<R;
do
{
R=RADICAL(base,e);
cout<<"el radical es: " ; cout<<R<<endl;
base=base+1;
} while (base<=m);
};break;
case 3:
{
cout<<"CAPACITANCIA"<<endl;
cout<<"Ingrese el voltaje"; cin>>v;
cout<<"Ingrese el angulo" ; cin>>t;
R1=CAPACITANCIA(v,t);
cout<<"la capacitancia es: "; cout<<R1;
{
double v,t;
for(v=1;v<=40;v=v+1)
for(t=1;t<=50;t=t+1)
R1=CAPACITANCIA(v,t);
cout<<"la capacitancia es: "; cout<<R1<<endl;
}//fin_for
};break;
case 4:
{
cout<<"INDUCTANCIA"<<endl;
cout<<"Ingrese el voltaje"; cin>>v;
cout<<"Ingrese el angulo"; cin>>t;
R2=INDUCTANCIA(v,t);
cout<<"la inductancia es: "; cout<<R2;
{
double v,t;
for(v=2; v<=250; v++)
for(t=3; t<=350;t= t+3)
{
R2=INDUCTANCIA(v,t);
cout<<"la inductancia es: " ; cout<<R2<<endl;
}
}//finfor
};break;
}//finswitch
}while (opcion=!0);
}
double HIPERBOLA (int a)
{
y=(1/pow(a,2))+4;
return y;
}
double RADICAL (int x ,int y)
{
Q=pow(x,y);
return Q;
}
double CAPACITANCIA (int x , int y)
{
R=(2*3.1416+y)/360;
Q=x*sin(R);
return Q;
}
double INDUCTANCIA (int x , int y)
{
R=(2*3.1416+y)/360;
Q=x*cos(R);
return Q;
}