Estoy haciendo un programa y tengo una función con bastantes sentencias if-else, creo que se podría reducir el código con la sentencia switch-case, pero no me funciona (creo que el problema está en reconocer cadenas de caracteres).
A continuación os dejo la función por si alguien sabe como ponerlo con la sentencia switch-case.
Un saludo!!
Código
int Comprobar_Archivo_Conf(char *cadena,int parametro) { { if (parametro>=500&¶metro<=1500) { segmento_01[ENERGIA_BOLAS_VERDES]=parametro; return 1; } } else { if (parametro>3&¶metro<7) { segmento_01[NUM_BOLAS_ROJAS]=parametro; return 1; } } else { if (parametro>=3&¶metro<=6) { segmento_01[INTERVALO_ROJAS]=parametro; return 1; } } else { if (parametro>=3&¶metro<=6) { segmento_01[INTERVALO_AZULES]=parametro; return 1; } } else { if (parametro>=3&¶metro<=5) { segmento_01[NUM_BOLAS_NEGRAS]=parametro; return 1; } } else { if (parametro>=3&¶metro<=6) { segmento_01[INTERVALO_NEGRAS]=parametro; return 1; } } else { if (parametro>=2&¶metro<=5) { segmento_01[BOLAS_VERDES_PEQUENAS]=parametro; return 1; } } else { if (parametro==100) { segmento_01[PUNTUACION_T1_ROJA]=parametro; return 1; } } else { if (parametro==120) { segmento_01[PUNTUACION_T2_ROJA]=parametro; return 1; } } else { if (parametro==140) { segmento_01[PUNTUACION_T3_ROJA]=parametro; return 1; } } else { if (parametro==160) { segmento_01[PUNTUACION_T4_ROJA]=parametro; return 1; } } else { if (parametro==200) { segmento_01[PUNTUACION_BOLA_NEGRA]=parametro; return 1; } } else { if (parametro>=10&¶metro<=25) { segmento_01[QUITA_ENERGIA_ROJA]=parametro; return 1; } } return 0; } // fin funcion Comprobar_Archivo_Conf