top of page

LABORATORIO 2

​

#include<iostream>

#include<math.h>

using namespace std;

//zona publica

double R,Q,pi=3.14,Qc,Qi,T;

double hiperbola(int a);

double raiz (int a,int b);

double capacitancia(int x,int y);

double inductancia(int x,int y);

int x,y,V,theta,base,exponente,max;

int main ()

{

int opcion;

do

{

cout<<"menu de problemas\n";

cout<<"1.- hiperbola \n";

cout<<"2.- radical \n";

cout<<"3.- capacitancia \n";

cout<<"4.- inductancia \n";

cout<<"ingrese una opcion: ";

cin>> opcion;

switch(opcion)

{

case 1:

{

// cin>> x;

for(x=-10;x<=10;x++)

{

R=hiperbola(x);

cout <<"para x= "<<x<<" el valor de f(x)= "<< R <<endl;

}

};break;

case 2:

{

base=1;

cin>>exponente;

do

{

R=raiz(base,exponente);

cout<<R<<endl;

base=base+1;

} while(base<=100);

};break;

case 3:

{

cout<<"ingrese el valor de teta: ";cin>> theta;

for(V=-15;V<=15;V++)

{

Qc=capacitancia(V,theta);

cout <<" para v= "<< V << " la capacitancias es: "<< Qc <<endl;

}

};break;

case 4:

{

cout<<"INGRESE EÑ VOLTAJE :"; cin >> V;

for(theta=1;theta<=15;theta++)

{

Qi=inductancia(V,theta);

cout <<" para el angulo= "<< theta << " la inductancia es: "<< Qi <<endl;

}

};break;

}//finswitch

} while(opcion=!0);

}//fin proceso

 

double hiperbola (int a)

{

y=pow(a,2)+4;

return y;

}

double raiz (int a,int b)

{

Q=pow(x,1/y);

return Q;

}

double capacitancia(int x,int y)

{

T=(y*pi)/180;

Qc= x*sin(T);

return Qc;

}

double inductancia(int x,int y)

{

T=(y*pi)/180;

Qi= x*cos(T);

return Qi;

}

bottom of page