LAB1

#include<iostream>
#include<math.h>
using namespace std;
int a, b, c, n, i, R1, R2, R3, Req, W, E;
float Fx;
int resistencia(int a, int b) ;
int POTENCIA (int E, int i);
int factorial (int n);
int paralelo (int i);
int RESISTENCIA (int R1, int R2, int R3);
int main ()
{//1)DECLARACION
int opcion;
cout<<"*********MENU DE FUNCIONES**********\n\n";
cout<<"1)RESISTENCIA \n";
cout<<"2)FACTORIAL \n";
cout<<"3)RESISTENCIA EN PARALELO \n";
cout<<"4)RESISTENCIA EN SERIE \n\n";
cout<<"       DIGITE <0> PARA SALIR \n\n";
cout<<"*************\n\n";
cout<<"   ELIJA UNA OPCION : "; cin>>opcion;
    //2)ASIGNACION
    switch (opcion)
    {
    case 1:
       {
       cout<<"******* RESISTENCIA ******\n\n";
       cout<<"INGRESE VOLTAJE : "; cin >>a;
       cout<<"INGRESE INTENSIDAD: "; cin >>b;
       // invocacion o llamado
       resistencia(a,b);
       cout<< "LA RESISTENCIA "<<a<<" / "<<b<<" = "<< resistencia(a,b)<<endl;
       cout<<"*************************************\n\n";
    } //FIN DEL CASO 1
     break;    
   case 2:
      {
      cout<<"*******  POTENCIA **************************\n\n";  
      cout<<"INGRESE LA CORRIENTE: "; cin>>i;
      cout<<"INGRESE  LA TENSION: "; cin>>E;
      POTENCIA (i,E);
      cout<<"LA POTENCIA ES: "<< W << endl;
      cout << endl;
      cout<<"**********************************************\n\n";
      } //FIN DEL CASO 3
      break;
    break;

    case 3:
          {
               cout<<"******* RESISTENCIA EN PARALELO ******\n\n";
     
      cout<<"INGRESE LA RESISTENCIA R1 : "; cin>>R1;
      cout<<"INGRESE LA RESISTENCIA R2 : "; cin>>R2;
      cout<<"INGRESE LA RESISTENCIA R3 : "; cin>>R3;
     cout<<"-------------------------------\n";
   
     Req = RESISTENCIA (R1,R2,R3);
     cout<<"LA RESISTENCIA EQUIVALENTE ES: "<<Req<<endl;
   
       
  }  //FIN DEL CASO 3
   break;
    case 4:
     {
      cout<<"******* RESISTENCIA EN SERIE ******\n\n";
      cout<<"INGRESE LA RESISTENCIA R1 : "; cin>>R1;
      cout<<"INGRESE LA RESISTENCIA R2 : "; cin>>R2;
      cout<<"INGRESE LA RESISTENCIA R3 : "; cin>>R3;
     cout<<"-------------------------------\n";
   
     Req = RESISTENCIA (R1,R2,R3);
     cout<<"LA RESISTENCIA EQUIVALENTE ES: "<<Req<<endl;
   
       
  }      //FIN DEL CASO 4      
}// FIN DE SWITCH
   
    cout<<endl;cout<<"\n";
    system("pause");
    return 0;
}//FIN DEL PROGRAMA
int resistencia(int a, int b)
{
    c = a / b;
    return c;
}
int paralelo (int i)
{
    1/Req = 1/R1 + 1/R2 + 1/R3;
    return Req;
}
int grafica (int i)
{
    Fx = pow(i,2) + 5;
    return Fx;
}
int RESISTENCIA (int R1, int R2, int R3)
{
    Req = R1 + R2 + R3;
    return Req;
}

No hay comentarios:

Publicar un comentario