¿Cómo escribir un menú sencillo en lenguaje C?
2. Generales:
#¿Incluir? ltiostream gt
#¿Contiene? ltstdlib.h gt
#¿Incluir? ltconio.h gt
#¿Contiene? ltctype.h gt
¿Usar? ¿Espacio de nombres? std
¿No es válido? ¿Xuanze envió a Xu ()? //Seleccione la función de clasificación
{
Printf("Para agregar, presione cualquier tecla para continuar...");
getchar();
p>}
¿No es válido? erfenpaixu()? //Función del método de búsqueda binaria
{
Printf("Para agregar, presione cualquier tecla para continuar...");
getchar() ;
}
¿Anulado? Menú()//Menú principal
{
Sistema("cls");? //Borrar la pantalla
Printf("\n\t\t\tmenu\ n ");
printf(" \ t \ t \ t # * * * * * * * * * * * * * * * * * * * * * * * \ n ");
printf(" \ t \ t # 1 selección ordenar # \ n ");
Printf ("\ t \ t # 2 método de búsqueda binaria # \ n ");
Printf ("\ t \ t # 3 retorno # \ n "); p>printf(" \ t \ t # 4-Cerrar? # \ n ");
printf(" \ t \ t \ t # * * * * * * * * * * * * * * * * * * * * * * * \ n ");
printf(" \ t \ t \ tPor favor seleccione (1-4)? =: ");
}
¿Anulado? Señor()
{
¿Ciel? Seleccione;
mientras(1)
{
menú();
Sistema("Color? 9f");?
scanf("c ", amp select);
if(select=='3 ')
break; p>
if(select=='3 ')
p>
Otro
{
getchar();? //Leer enter
If (!isdigit(select))? //Si no es un carácter numérico
{
printf(" \ n \ 7¿Su? elección? ¿Puede? ¿Es? ¿Incorrecto? ¿Debe? ingresar? ¿ese? número! \n ") ;_ getch();
}
Otro
{
¿Cambiar? (Seleccionar)
{
¿Caso? '1': ?xuansepaixu(); romper;
¿Caso? '2': ?erfenpaixu(); romper;
¿Caso? "4": salida(0);? //Salir directamente
Predeterminado:?
{
printf(" \ n \ 7 \ 7¿Tu? ¿Seleccionado? ¿Número? ¿Mayo? ¿Es? ¿Incorrecto? ¿Seleccionado? ¡Aquí viene de nuevo!\n ") ;
_ getch();
Romper;
}
}
}
}
};
}