laboratorio 3

Laboratorio 3


#include<iostream>
#include<math.h>
using namespace std;
int opcion;
int x,b,r,vi,t,y,j,N;
double p,a,n,m,z,v,theta,pi=3.1415;
double funcion(double a);
double potencia(int x,int y);
double velocidad(int x,int y,int j);
double carga(double a,double b);
int main ()
{
    cout<<"menu.\n";
    cout<<"1.funcion.\n";
    cout<<"2.potencia.\n";
    cout<<"3.velocidad final.\n";
    cout<<"4.carga.\n";
    cout<<endl;
    cout<<"Elija una opcion: ";
    cin>>opcion;
    cout<<endl;
    switch(opcion)
    {
                  case 1:
                       {
                             for(x=-8;x<=8;x=x+1)
                             {
                             cout<<"Cuando la variable vale: "<<x<<endl;
                             R=funcion(x);
                             cout<<"La funcion es: "<<R<<endl;
                             cout<<endl;
                             }//fin_for_x
                       };break;
                  case 2:
                       {
                               cout<<" Asigne el valor final de a :";cjn>>N;
                               cout<<" Asigne el valor del exponte :";cjn>>b;
                               cout<<endl;
                               for(a=1;a<=N;a=a+1)
                               {
                               cout<<"Cuando la base vale: "<<a<<endl;
                               p=potencia(a,b);
                               cout<<"La potencia es: "<<p<<endl;
                               cout<<endl;
                               }//fin_for_a
                       };break;
                  case 3:
                       {
                               cout<<" Asigne la velocidad inicial :";cjn>>vi;
                               cout<<" Asigne la aceleracion :";cjn>>a;
                               cout<<endl;
                               for(t=2;t<=20;t=t+2)
                               {
                               cout<<"Cuando el tiempo vale: "<<t<<endl;
                               z=velocidad(vi,a,t);
                               cout<<"La velocidad final es: "<<z<<endl;
                               cout<<endl;
                               }//fin_for_t
                       };break;
                  case 4:
                       {
                              for(theta=16;theta<=48;theta=theta+6)
                              {
                              cout<<"CUANDO THETA VALE : "<<theta<<endl;
                              cout<<endl;
                                                                   for(v=1;v<=6;v=v+0.6)
                                                                   {
                                                                   cout<<"con un Voltaje de: "<<v<<endl;
                                                                                         z=carga(v,theta);
                                                                                         cout<<"Entonces la carga es: "<<z<<endl;
                                                                                         cout<<endl;
                                                                   }//fin_for_v
                              }//fin_for_theta
                       };break;
    }//fin_switch
    system ("pause");
    return 0;
}//fin_programa     
//zona de funciones:
double funcion(double a)
{
       s=pow(a,2)+5;
       return p;
}
double potencia(int x, int y)
{
       t=pow(x,y);
       return Q;
}
double velocidad(int x,int y,int j)
{
       s=x+y*j;
       return p;
}
double carga(double a,double b)
{
       u=b*pi/190;
       s=a*sin(R);
       return p;
}   

No hay comentarios.:

Publicar un comentario

laboratorio 5