top of page

#include <iostream>
#include <math.h>
using namespace std;
 int main ()
{
    int opcion;
    cout<<"hallar la capacitancia\n";
    cout<<"hallar impedancia \n";
    cout<<"hallar conrriente inductiva\n";
    cout<<"hallar capacitancia\n";
cout<<"ingrese una opcion";
cin>>opcion;
switch ( opcion )
{
case 1:{                                             
    double v1,v2,I,r,xl,xc;
        cin>>v1;
        cin>>v2;
        cin>>xl;
        cin>>xc;
        r=60;
    do{
        I=v2-v1/sqrt(pow(r,2)+pow(xl+xc,2));
        r=r+15;
        cout<<I<<endl;
    }
    while(r<=200);
    }
    break;
case 2:{                                       
        double vp,w,c,I,t,pi=3.14;
    cout<<"Voltaje: ";    cin>>vp;
    cout<<"ingrese w: ";cin>>w;
    cout<<"tiempo: ";    cin>>t;
    c=30;
    do{
        I=(vp*w*c)*cos(w*t+pi/2);
        c=c+10;
        cout<<I<<endl;
    }
    while(c<=100);
    }
    break;
case 3:{                                        
    double r,z,A,i,w,l,c;
    cout<<"resistencia: ";cin>>r;
    cout<<"ingrese i: ";    cin>>i;
    cout<<"ingrese w: ";    cin>>w;
    cout<<"capacitancia: ";    cin>>c;
    l=20;
    do{
        A=((w*l)-1/w*c);
        cout<<"z="<<r<<" + i" << A <<endl;
        l=l+12;
    }
    while(l<=160);
}
    break;
    case 4:{                          
        double i,l,t,v1,v2,w,pi=3.14;
        cout<<"ingrese l ";    cin>>l;
        cout<<"tiempo ";cin>>t;
        cout<<"voltaje 1 ";cin>>v1;
        cout<<"voltaje 2 ";cin>>v2;
        w=10;
        do {
            i=((v2-v1)/w*l)*sin(w*t-pi/2);
            w=w+40;
            cout<<i<<endl;
        }
        while(w<=180);
    }
        break;
}
}

bottom of page