Backup proyecto Joyfe - Borland

This commit is contained in:
2025-06-16 22:54:10 +02:00
commit d61829a1a7
130 changed files with 11881 additions and 0 deletions

149
CPP/MENU.~CP Normal file
View File

@ -0,0 +1,149 @@
/* ESTE PROGRAMA GENERA UN MENU DE 3 OPCIONES, DONDE LAS OPCIONES SON
SELECCIONADAS POR LOS CURSORES Y LA TECLA ENTER*/
#include <stdio.h>
#include <conio.h>
#include <string.h>
/* PROTOTIPOS DE LAS FUNCIONES UTILIZADAS */
void impri(int,char[],int,int);/*IMPRIME LAS OPCIONES DEL MENU int,COLOR DE
IMPRESION, cha[],CADENA A IMPRIMIR,
int, COLUMNA, int, FILA*/
void cursor(char[3][10],int,int,int);/* MANEHO DE LOS CURSORES Y SELECION DE
OPCION, char[3][10],MATRIZ DE CADENAS
int,COLUMNA, int,FILA int,INDICE PARA
LA MATRIZ*/
void main()
{
_setcursortype(_NOCURSOR);/*FUNCION QUE NOS PERMITE OCULTAR EL CURSOR EN
PANTALLA SUS POSIBLES VALORES SON:
_NOCURSOR: EL CURSOR NO APARECE VALOR 0
_SOLIDCURSOR: EL CURSOR APARECE GRUESO VALOR 1
_NORMALCURSOR: NORMAL CURSOR VALOR 2
_setcursortype(int) se encuentra en conio.h
en dicha libreria estan definidas las
constantes _NOCURSOR,_SOLIDCURSOR Y _NORMALCURSOR*/
int sw=0,color,c,f,col,fil, indice;
char cad[3][10]={"PRIMERA","SEGUNDA","SALIR"};/* MATRIZ DE CADENAS, CON LAS
OPCIONES DEL MENU*/
clrscr();
color=7;
impri(color,cad[0],30,10);
impri(color,cad[1],30,12);
impri(color,cad[2],30,14);
col=30;
fil=10;
indice=0;
while(sw==0)
{
cursor(cad,col,fil,indice);
if(wherey()==10)
{ col=30;
fil=10;
gotoxy(20,24);
textcolor(142);
cprintf("OPCION PRIMERA");
textcolor(14);
cprintf("\t PULSE UNA TECLA PARA VOLVER AL MENU");
textcolor(7);
getch();
gotoxy(20,24);
printf("
");
indice=0;
}
else
if(wherey()==12)
{
col=30;
fil=12;
gotoxy(20,24);
textcolor(142);
cprintf("OPCION SEGUNDA");
textcolor(14);
cprintf("\t PULSE UNA TECLA PARA VOLVER AL MENU");
textcolor(7);
gotoxy(20,24);
getch();
printf(" ");
indice=1;
}
else
{
col=30;
fil=14;
gotoxy(20,24);
textcolor(142);
printf("SALIR");
textcolor(14);
cprintf("\t PULSE UNA TECLA PARA VOLVER AL MENU");
textcolor(7);
sw=1;
getch();
gotoxy(20,24);
printf(" ");
indice=2;
}
}
_setcursortype(_NORMALCURSOR);
}
//DESARROLLO DE LAS FUNCIONES
void impri(int color, char cad[],int c,int f)
{
textcolor(color);
gotoxy(c,f);
cprintf("OPCION %s",cad);
}
void cursor(char cad[3][10],int c,int f,int indice)
{
int sw=0,i,a;
gotoxy(c,f);
impri(14,cad[indice],c,f);
while(sw==0)
{
i=getche();
if(i==0)
{
a=getch();
switch(a)
{
case 72:
{
gotoxy(c,f);
impri(7,cad[indice],c,f);
if(f==10)
f=14;
else
f=f-2;
gotoxy(c,f);
if(indice==0)
indice=2;
else
indice--;
impri(14,cad[indice],c,f);
break;
}
case 80:
{
gotoxy(c,f);
impri(7,cad[indice],c,f);
if(f==14)
f=10;
else
f=f+2;
gotoxy(c,f);
if(indice==2)
indice=0;
else
indice++;
impri(14,cad[indice],c,f);
break;
}
}
}
else
if(i==13)
sw=1;
}
}