
#include<iostream>
#include<math.h>
using namespace std;
double Fx,R,Q;
double x,a,n,B,P,i;
double r,xl,xc,I,V;
double p,v,pi=3.14,m,d; //problema 4 y 5
double PARABOLA(int a); //VARIABLE DE PASO
double RAIZ (int x,int y);
double CORRIENTE(int x,int y ,int z,int q);
double POTENCIA(int A,int b,int c);
int opcion;
int main ()
{
cout<<"*******MENU*******\n";
cout<<"1.-FUNCION(PARABOLA) :\n";
cout<<"2.-FUNCION(PARABOLA) c/BUCLE :\n";
cout<<"3.-RAIZ :\n";
cout<<"4.-CORRIENTE :\n";
cout<<"5.-CORRIENTE BUCLE 1 :\n";
cout<<"6.-POTENCIA :\n";
cout<<"7.-POTENCIA BUCLE :\n";
cout<<"ingrese una opcion: ";
cin>> opcion;
switch(opcion)
{
case 1:
{
cout<<"---PARABOLA----\n";
Q= PARABOLA(x);
cout <<"para x: "<<x<<" el valor de f(x)= "<< r <<endl;
};break;
case 2:
{
for(x=-5;x<=5;x++)
{
R= PARABOLA(x);
cout <<"para x: "<<x<<" el valor de f(x)= "<< x <<endl;
}
};break;
case 3:
{
cout<<"-----RAIZ-----\n";
a=1;
cin>>n;
cin>>B;
do
{
R=RAIZ(a,B);
cout<<R<<endl;
a=a++;
} while(a<=n);
};break;
case 4:
{
cout<<"-----CORRIENTE-----\n";
cout<<"Ingrese el Voltaje: "; cin>>V;
cout<<"Ingrese r: "; cin>>r;
cout<<"Ingrese xl: "; cin>>xl;
cout<<"Ingrese xc: "; cin>>xc;
I=CORRIENTE(V,r,xl,xc);
cout<<I<<endl;
};break;
case 5: //corriente 1 bucle
{
cout<<"Ingrese xl: "; cin>>xl;
cout<<"Ingrese xc: "; cin>>xc;
for(V=5; V<=10; V=V+5)
for(r=6; r<=12; r=r++)
{
I=CORRIENTE(V,r,xl,xc);
cout<<I<<endl;
}
};break;
case 6:
{
cout<<"-----POTENCIA-----\n";
cout<<"Ingrese el angulo: ";cin>>m;
cout<<"Ingrese voltaje : ";cin>>v;
cout<<"Ingrese intensidad: ";cin>>i;
P=POTENCIA(v,i,m);
cout<<P<<endl;
};break;
case 7: //POTENCIA 1 bucle
{
cout<<"Ingrese el angulo: ";cin>>m;
for(v=2; v<=8; v=v++)
for(i=4; i<=20; i=i+4)
{
P=POTENCIA(v,i,m);
cout<<P<<endl;
}
};break;
}
}//fin proceso
double PARABOLA(int a)
{
Q=(1/pow(a,2))+3;
return Q ;
}
double RAIZ (int x,int y)
{
Q=pow(x,1/y);
return Q;
}
double CORRIENTE(int x,int y ,int z,int q)
{
I=x/(sqrt(pow(y,2)+(z+q,2)));
return I;
}
double POTENCIA(int A,int b,int c)
{
d=(2*pi*c/360);
P=A*b*(cos(d));
return P;
}
}