LAB3
#include <iostream>
#include <math.h>
using namespace std;
int a,b,x,pot,vo,t,v,N,P,theta,w;
double Fx,R,vel,vel_inicial,energ,energia_condensador,RAD,PI=3.1415,enrg;
double parabola(int a);
double funcion( int x);
double potencia(int p, int q);
double enesimo_numero(int r,int s);
double velocidad_final (int a, int b, int c);
double energia_de_condensador (double v, double w);
int main()
{
int Opcion;
cout<<"****** M E N U ****** \n\n";
cout<<" 1)PARABOLA \n";
cout<<" 2)FUNCION\n";
cout<<" 3)POTENCIA \n";
cout<<" 4)ENESIMO NUMERO \n";
cout<<" 5)VELOCIDAD FINAL\n";
cout<<" 6)ENERGIA DE CONDENSADOR\n";
cout<<" INGRESE UNA OPCION:"; cin>>Opcion;
switch (Opcion)
{
case 1:
{
cin >> x ;
Fx=pow(x,2)+5;
cout<<Fx<<endl;
}; break;
case 2:
{
for (x=-5;x<=5;x++)
{
R=funcion(x);//invocacion
cout <<R<<endl;
}
}; break;
case 3:
{
cin>>a;cin>>b;
pot=potencia(a,b);
cout<<pot<<endl;
}; break;
case 4:
{
cout<<"ingrese el enesimo numero";
cin>>N;cin>>b;
a=1;
while(a <=N)
{
P= potencia(a,b);
cout<<P<<endl;
a++;
}
}; break;
case 5:
{
for (a=10;a<=40;a=a+2)
{
cin>>vo;cin>>a;cin>>t;
vel=velocidad_final(vo,a,t);
cout<< vel<<endl;
}
};break;
case 6:
{
for(theta=10;theta<=360;theta=theta+15);
{
cin>>v;cin>>theta;
energ= energia_condensador*(theta,v);
cout<<energ<<endl;
}
}
} // Fin del Switch
} //fin del programa
system("pause");
return 0;
//zona de funciones
double funcion(int a)
{
Fx=pow(a,2)+5;
return Fx;
}
double parabola( int x)
{
R=funcion(x);
return R;
}
double potencia(int p, int q)
{
pot=pow(p,q);
return pot;
}
double enesimo_numero(int r,int s)
{
P=pow(a,b);
return P;
}
double velocidad_final (int a, int b, int c)
{
vel=a+b*c;
return (vel);
}
double energia_de_condensador (double v, double w)
{
RAD=(2*PI*w)/360;
enrg=v* sin(RAD);
}
No hay comentarios.:
Publicar un comentario