viernes, 22 de junio de 2018

LAB 2

#include<iostream>
#include<math.h>
using namespace std;
int opcion ,a,b,x,p,q,n,t,vi,v,g;
double fx,r, pi=3.1415 ,R,P,A,Q,RAD;
double funcion(int a);
double potencia(int p, int q);
double fun(int x, int y, int z);
double carga(int x, int y);
int main()
{
    cout<<"menu\n";
    cout<<"1. parabola\n";
    cout<<"2. potencia\n";
    cout<<"3. parabola1\n";
    cout<<"4. potencia2\n";
    cout<<"5. velocidad final\n";
    cout<<"6. carga capacitiva\n";
    cout<<"elija 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);
                                     cout<<R<<endl;
                                     }
                                     };break;
    case 3:
         {
                                     cin>>a;cin>>b;
                                     R=potencia(a,b);
                                     cout<<R<<endl;
                                     };break;
    case 4:
         {
                                     cout<<"ingrese el enecimo numero";
                                     cin>>n; cin>> b;
                                     a=1;
                                     while (a<=n)
                                     {
                                           P=potencia(a,b);
                                           cout<<P<<endl;
                                           a++;
                                           }
                                           };break;
    case 5:
         {
                                           cout<<"ingrese el vi"<<endl;
                                           cout<<"ingrese el aceleracion"<<endl;
                                           cout<<"ingrese el tiempo"<<endl;
                                           cin>>vi ; cin>>a;
                                           for(t=10;t<=50;t=t+5)
                                           {
                                           A=fun(vi,a,t);              
                                           cout<<A<<endl;
                                           }
                                           };break;
    case 6:
         {
                                           cout<<"ingrese el voltaje"<<endl;
                                           cout<<"ingrese el angulo"<<endl;
                                           cin>>v; cin>>g;
                                           R=carga(v,g);
                                           cout<<R<<endl;
                                           };break;
                                           }//fin_switch
                                           system ("pause");
                                           return 0;
                                           }//fin_programa
                                          
  //zona de funciones
  double funcion (int a)
  {
         P=pow(a,2)+5;
         return P;
         }
  double potencia(int p, int q)
  {
         Q=pow(p,q);
         return Q;
         }
  double fun(int x, int y , int z)
  {
                   R=x+(y*x);
                   return R;
  }
  double carga(int x , int y)
  {
         RAD=(2*pi*y)/360;
         R=x*sin(RAD);
         return R;
         }

LAB 2

#include<iostream> #include<math.h> using namespace std; int opcion ,a,b,x,p,q,n,t,vi,v,g; double fx,r, pi=3.1415 ,R,P,...