Ver Mensaje Individual
  #2 (permalink)  
Antiguo 14/12/2016, 23:31
Avatar de Jose_A
Jose_A
 
Fecha de Ingreso: mayo-2015
Ubicación: México, Sonora.
Mensajes: 180
Antigüedad: 8 años, 9 meses
Puntos: 0
Respuesta: Evaluar en otra función

Código:
//----------------------------------------------------------------------------//
int Menu()
{
    int opc;   
     do{
            
           cout << "Seleccione la funci" << (char) 162 << "n a utilizar:" << endl;       
           cout << "(" << PRIMERA << ") X^3+4^2-10" << endl;
           cout << "(" << SEGUNDA << ") ( cos(x)/4 )-x+5" << endl;
           cout << "(" << TERCERA << ") x^2-x-24" << endl;
           cout << "(" << SALIR << ") Salir." << endl;  
           
           cin >> opc;
           
           system("cls");
           
           if( opc<SALIR || opc>TERCERA )
               cout << "\aERROR: Acci" << (char) 162 << "n no definida." << endl;
               
     }while( opc<SALIR || opc>TERCERA);
     
     system("cls");
     
     return opc;       
}

//Funciones

float FuncionF(int funcion, float punto)
{
    switch(funcion){
            case PRIMERA:
                return pow(punto,4)+(2*pow(punto,2))-punto-3;
                
            case SEGUNDA:
                return (cos(punto)/4)-punto+5;

            case TERCERA:
                return pow(punto,2)-punto-24;

    }
}

float FuncionG(int funcion, float punto)
{
    switch(funcion){
            case PRIMERA:
                return sqrt((punto+3)/(pow(punto,2)+2));
                
            case SEGUNDA:
                return (cos(punto)/4)+5;

            case TERCERA:
                return sqrt(24+punto);

    }
}

float Absoluto(float num)
{
    if(num>0) return num;
    if(num<0) return -num;
    return 0;   
}
Una función distinta, por ejemplo en lugar de X^3+4^2-10 usar 5x^3 -2 ??

Intenté remplazar pero no me da el resultado que debería ser...