seccion 9 funciones:
- Oscar Anthonny Echegaray Neyra
- 19 jun 2018
- 1 Min. de lectura
#include<iostream>
#include<math.h>
using namespace std;
//zona publica
double R,Q,pi=3.14,Qc,Qi, T, a, y;
double HIPERBOLA(int a);
double raiz (int x,int y);
double capacitancia(int v,int q);
double inductancia(int a,int b);
int x,v,p,v1,q,m,b, max1;
int main ()
{
int opcion;
do
{
cout<<"*******MENU*******\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:
{
cout<<"----HIPERBOLA----\n";
for(x=-10;x<=10;x++)
{
R= HIPERBOLA(x);
cout <<"para x: "<<x<<" el valor de f(x)= "<< R <<endl;
}
};break;
case 2:
{
cout<<"-----RADICAL-----\n";
x=1;cin>>y;
do
{
R=pow(x,1/y);
cout<<R<<endl;
x=x+1;
} while(x=20);
};break;
case 3:
{
cout<<"-----CAPACITANCIA-----\n";
// cout<<"ingrese el valor del voltaje: ";cin>>v;
cout<<"ingrese el valor maximo: "; cin>>max1;
cout<< "ingresar el angulo: ";cin>>q;
v=100;
do
{
Qc=capacitancia(v,q);
cout << Qc << endl;
v=v+2;
}while(v<=max1);
};break;
case 4:
{
cout<< "-----INDUCTANCIA-----\n";
for(v1=5; v1<=60; v1=v1+5)
for (p=2; p<=8; p++)
{
Qi=inductancia(v1,p);
cout<< Qi << endl;
}
};break;
}//fin switch
} while(opcion=!0);
}//fin proceso
double HIPERBOLA(int a)
{
y=(1/pow(a,2))+4;
return y;
}
double raiz (int a,int b)
{
Q=pow(x,1/y);
return Q;
}
double capacitancia(int V,int q)
{
a=(q*2*pi)/180;
Qc= v*sin(a);
return Qc;
}
double inductancia(int a,int b)
{
R=(b*2*pi)/180;
Qi= a*cos(R);
return Qi;
}
Comments