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=-20;V<=20;V++)
                      {
                      
                      Qc=capacitancia(V,theta);
                      cout <<" para v= "<< V << " LA CAPACITANCIA ES: "<< Qc <<endl;
                      }
                  
                  };break;
                      case 4:
                  {
                      cout<<"INGRESE EL VOLTAJE :"; cin >> V;
                  
                      for(theta=1;theta<=30;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