837 lines
15 KiB
C++
837 lines
15 KiB
C++
//BIBLIOTECAS EMPLEADAS
|
||
//Bibliotecas
|
||
#include<math.h>
|
||
#include<ctype.h>
|
||
#include<alloc.h>
|
||
#include<string.h>
|
||
#include<dos.h>
|
||
#include<stdio.h>
|
||
#include<bios.h>
|
||
#include<conio.h>
|
||
|
||
//VARIABLES GLOBALES
|
||
struct datos{ char nombre[20];
|
||
char apodo[20];
|
||
char numero[20];
|
||
|
||
}datos;
|
||
|
||
typedef struct nodo{ char nombre[20];
|
||
char apodo[20];
|
||
char numero[20];
|
||
struct nodo *sig;
|
||
}INFO;
|
||
|
||
struct simbolo{ char letra;
|
||
|
||
}simbolo;
|
||
|
||
typedef struct nodo1{ char letra;
|
||
struct nodo1 *sig;
|
||
struct nodo1 *ant;
|
||
|
||
}LET;
|
||
int matriz1;
|
||
char matriz2[80];
|
||
|
||
//DECLARACION DE FUNCIONES
|
||
void diario(int subopcion);
|
||
void captura(int tam,int elec,char nombre[80],int x,int y);
|
||
void telefonos(int subopcion);
|
||
INFO * recupera();
|
||
void introducir(INFO *plista);
|
||
INFO * borrar(INFO *plista);
|
||
void contenido(INFO *plista);
|
||
void busca(INFO *plista);
|
||
void visualizaag(void);
|
||
LET * introduceag(void);
|
||
void hora(void);
|
||
void creditos(void);
|
||
void dibujaeleccion(int opcion);
|
||
int dibujasubmenu1(int opcion);
|
||
void recuadro(int x,int y,int x1,int y1,int o);
|
||
void marco(int x,int y,int x1,int y1);
|
||
void menu(void);
|
||
|
||
//FUNCION PRINCIPAL
|
||
void main()
|
||
{
|
||
int opcion=1,a=0;
|
||
clrscr();
|
||
textbackground(0);
|
||
_setcursortype(_NOCURSOR);
|
||
menu();
|
||
while(opcion!=4||a!=7181)
|
||
{
|
||
dibujaeleccion(opcion);
|
||
while(!kbhit())
|
||
{
|
||
hora();
|
||
}
|
||
a=bioskey(0);
|
||
if(a==7181&&opcion!=4) opcion=dibujasubmenu1(opcion);
|
||
if(a==19712) opcion++;
|
||
if(a==19200) opcion--;
|
||
if(opcion==0) opcion=4;
|
||
if(opcion==5) opcion=1;
|
||
}
|
||
_setcursortype(_NORMALCURSOR);
|
||
textbackground(0);
|
||
clrscr();
|
||
}
|
||
|
||
//DIBUJA EL INTERFAZ GENERAL
|
||
void menu()
|
||
{
|
||
clrscr();
|
||
textattr(LIGHTGRAY);
|
||
recuadro(2,2,79,24,1);
|
||
recuadro(2,1,79,1,0);
|
||
recuadro(2,25,79,25,0);
|
||
}
|
||
|
||
//DIBUJA ELECCION
|
||
void dibujaeleccion(int opcion)
|
||
{
|
||
textattr(LIGHTGRAY);
|
||
textattr(127);
|
||
gotoxy(3,1);
|
||
cprintf(" DIARIO TELEFONOS INFORMACION FINALIZAR");
|
||
gotoxy(3,25);
|
||
cprintf("F1 ayuda");
|
||
textattr(LIGHTGRAY);
|
||
switch(opcion)
|
||
{
|
||
case 1:gotoxy(8,1);cprintf("DIARIO");break;
|
||
case 2:gotoxy(24,1);cprintf("TELEFONOS");break;
|
||
case 3:gotoxy(43,1);cprintf("INFORMACION");break;
|
||
case 4:gotoxy(64,1);cprintf("FINALIZAR");break;
|
||
}
|
||
}
|
||
//DIBUJA SUBMENUS
|
||
int dibujasubmenu1(int opcion)
|
||
{
|
||
//subopcion son CURSOS,subopcion1 son CLASES DE CURSOS
|
||
//subopcion son eleccion de submenus
|
||
int a=0,subopcion1=1,subopcion2=1,subopcion3=1;
|
||
while(a!=7181&&a!=283)
|
||
{
|
||
switch(opcion)
|
||
{
|
||
case 1: //DIARIO
|
||
recuadro(5,2,18,5,2);
|
||
marco(5,2,18,5);
|
||
while(a!=7181&&a!=283&&a!=19712&&a!=19200)
|
||
{
|
||
textattr(127);
|
||
gotoxy(7,3);cprintf("INTRODUCIR");
|
||
gotoxy(7,4);cprintf("VISUALIZAR");
|
||
textattr(LIGHTGRAY);
|
||
switch(subopcion1)
|
||
{
|
||
case 1: gotoxy(7,3);cprintf("INTRODUCIR");break;
|
||
case 2: gotoxy(7,4);cprintf("VISUALIZAR");break;
|
||
}
|
||
while(!kbhit())
|
||
{
|
||
hora();
|
||
}
|
||
a=bioskey(0);
|
||
if(a==20480) subopcion1++;
|
||
if(a==18432) subopcion1--;
|
||
if(subopcion1==0) subopcion1=2;
|
||
if(subopcion1==3) subopcion1=1;
|
||
}
|
||
if(a!=283&&a!=19712&&a!=19200) diario(subopcion1);
|
||
textattr(LIGHTGRAY);recuadro(5,2,19,6,1);
|
||
break;
|
||
case 2: //TELEFONO
|
||
recuadro(24,2,37,7,2);
|
||
marco(24,2,37,7);
|
||
while(a!=7181&&a!=283&&a!=19712&&a!=19200)
|
||
{
|
||
textattr(127);
|
||
gotoxy(26,3);cprintf("INTRODUCIR");
|
||
gotoxy(26,4);cprintf("VER LISTA");
|
||
gotoxy(26,5);cprintf("BORRAR");
|
||
gotoxy(26,6);cprintf("BUSCAR");
|
||
textattr(LIGHTGRAY);
|
||
switch(subopcion2)
|
||
{
|
||
case 1: gotoxy(26,3);cprintf("INTRODUCIR");break;
|
||
case 2: gotoxy(26,4);cprintf("VER LISTA");break;
|
||
case 3: gotoxy(26,5);cprintf("BORRAR");break;
|
||
case 4: gotoxy(26,6);cprintf("BUSCAR");break;
|
||
}
|
||
while(!kbhit())
|
||
{
|
||
hora();
|
||
}
|
||
a=bioskey(0);
|
||
if(a==20480) subopcion2++;
|
||
if(a==18432) subopcion2--;
|
||
if(subopcion2==0) subopcion2=4;
|
||
if(subopcion2==5) subopcion2=1;
|
||
}
|
||
if(a!=283&&a!=19712&&a!=19200)
|
||
{
|
||
telefonos(subopcion2);
|
||
}
|
||
textattr(LIGHTGRAY);recuadro(24,2,38,8,1);
|
||
break;
|
||
case 3: //INFORMACION
|
||
recuadro(42,2,55,5,2);
|
||
marco(42,2,55,5);
|
||
while(a!=7181&&a!=283&&a!=19712&&a!=19200)
|
||
{
|
||
textattr(127);
|
||
gotoxy(46,3);cprintf("AYUDAS");
|
||
gotoxy(45,4);cprintf("CREDITOS");
|
||
textattr(LIGHTGRAY);
|
||
switch(subopcion3)
|
||
{
|
||
case 1: gotoxy(46,3);cprintf("AYUDAS");break;
|
||
case 2: gotoxy(45,4);cprintf("CREDITOS");break;
|
||
}
|
||
while(!kbhit())
|
||
{
|
||
hora();
|
||
}
|
||
a=bioskey(0);
|
||
if(a==20480) subopcion3++;
|
||
if(a==18432) subopcion3--;
|
||
if(subopcion3==0) subopcion3=2;
|
||
if(subopcion3==3) subopcion3=1;
|
||
}
|
||
if(subopcion3==1&&a!=283) hora();
|
||
else if(a!=283&&a!=19712&&a!=19200) creditos();
|
||
textattr(LIGHTGRAY);recuadro(42,2,56,6,1);
|
||
break;
|
||
case 4: //FINALIZAR
|
||
while(!kbhit())
|
||
{
|
||
hora();
|
||
}
|
||
a=bioskey(0);
|
||
break;
|
||
}
|
||
//if(opcion==4) a=bioskey(0);
|
||
if(a==19712) {a=0;opcion++;}
|
||
if(a==19200) {a=0;opcion--;}
|
||
if(opcion==0) opcion=4;
|
||
if(opcion==5) opcion=1;
|
||
dibujaeleccion(opcion);
|
||
}
|
||
return opcion;
|
||
}
|
||
|
||
|
||
//FUNCION PARA CREAR UN RECUADRO EN LAS COORDENADAS INDICADAS
|
||
void recuadro(int x,int y,int x1,int y1,int o)
|
||
{
|
||
int a,b;
|
||
textattr(LIGHTGRAY);
|
||
for(a=x;a!=x1+1;a++)
|
||
for(b=y;b!=y1+1;b++)
|
||
{
|
||
gotoxy(a,b);
|
||
if(o==0||o==2) cprintf("<EFBFBD>");
|
||
else cprintf("<EFBFBD>");
|
||
}
|
||
if(o==2)
|
||
{
|
||
textattr(0);
|
||
for(a=y+1;a<y1+2;a++)
|
||
{
|
||
gotoxy(x1+1,a);
|
||
cprintf("<EFBFBD>");
|
||
}
|
||
for(a=x+1;a<x1+1;a++)
|
||
{
|
||
gotoxy(a,y1+1);
|
||
cprintf("<EFBFBD>");
|
||
}
|
||
}
|
||
}
|
||
|
||
//FUNCION PARA ENMARCAR UN RECUADRO
|
||
void marco(int x,int y,int x1,int y1)
|
||
{
|
||
int a,b;
|
||
textattr(127);
|
||
gotoxy(x,y);
|
||
cprintf("<EFBFBD>");
|
||
gotoxy(x,y1);
|
||
cprintf("<EFBFBD>");
|
||
gotoxy(x1,y);
|
||
cprintf("<EFBFBD>");
|
||
gotoxy(x1,y1);
|
||
cprintf("<EFBFBD>");
|
||
|
||
for(a=x+1;a!=x1;a++)
|
||
{
|
||
gotoxy(a,y);
|
||
cprintf("<EFBFBD>");
|
||
gotoxy(a,y1);
|
||
cprintf("<EFBFBD>");
|
||
|
||
}
|
||
|
||
for(b=y+1;b!=y1;b++)
|
||
{
|
||
gotoxy(x,b);
|
||
cprintf("<EFBFBD>");
|
||
gotoxy(x1,b);
|
||
cprintf("<EFBFBD>");
|
||
|
||
}
|
||
}
|
||
|
||
/////////////////////////////////INFORMACION////////////////////////////////
|
||
//HORA
|
||
void hora()
|
||
{
|
||
struct time t;
|
||
_setcursortype(_NOCURSOR);
|
||
gettime(&t);
|
||
gotoxy(72,25);
|
||
textattr(47);
|
||
cprintf("%2d:%02d:%02d",t.ti_hour, t.ti_min, t.ti_sec);
|
||
textattr(127);
|
||
}
|
||
|
||
//CREDITOS
|
||
void creditos()
|
||
{
|
||
recuadro(23,10,60,14,0);
|
||
marco(23,10,60,14);
|
||
gotoxy(25,11);
|
||
cprintf("PROGRAMADOR:OSCAR GANDUL ALONSO");
|
||
gotoxy(25,12);
|
||
cprintf("RECUERDOS A:JD,DANIEL SANDE,NICO..");
|
||
gotoxy(25,13);
|
||
cprintf("EL PROGRAMA ES ABURRIDO,PERO PIJO");
|
||
while(!kbhit())
|
||
{
|
||
hora();
|
||
}
|
||
//fflush(stdin);
|
||
textattr(LIGHTGRAY);
|
||
recuadro(23,10,60,14,1);
|
||
}
|
||
|
||
/////////////////////////////////TELEFONOS//////////////////////////////////
|
||
//FUNCION PRINCIPAL
|
||
void telefonos(int subopcion)
|
||
{
|
||
INFO *plista,*lista;
|
||
FILE *fp;
|
||
plista=recupera();
|
||
switch(subopcion)
|
||
{
|
||
case 1:introducir(plista);break;
|
||
case 2:contenido(plista);break;
|
||
case 3:plista=borrar(plista);break;
|
||
case 4:busca(plista);break;
|
||
}
|
||
fp=fopen("tel.dat","wb");
|
||
lista=plista;
|
||
while(lista->sig!=NULL)
|
||
{
|
||
strcpy(datos.nombre,lista->nombre);
|
||
strcpy(datos.apodo,lista->apodo);
|
||
strcpy(datos.numero,lista->numero);
|
||
fwrite(&datos,sizeof(datos),1,fp);
|
||
lista=lista->sig;
|
||
}
|
||
fclose(fp);
|
||
}
|
||
//METE DATOS
|
||
void introducir(INFO *plista)
|
||
{
|
||
INFO *lista;
|
||
lista=plista;
|
||
recuadro(25,10,52,14,2);
|
||
marco(25,10,52,14);
|
||
while(lista->sig!=NULL)
|
||
{
|
||
lista=lista->sig;
|
||
}
|
||
lista->sig=(INFO *)malloc(sizeof(INFO));
|
||
gotoxy(27,11);
|
||
cprintf("Nombre:");
|
||
captura(10,0,lista->nombre,34,11);
|
||
gotoxy(27,12);
|
||
cprintf("Apodo:");
|
||
captura(11,0,lista->apodo,33,12);
|
||
gotoxy(27,13);
|
||
cprintf("Numero:");
|
||
captura(10,0,lista->numero,34,13);
|
||
lista=lista->sig;
|
||
lista->sig=NULL;
|
||
textattr(LIGHTGRAY);
|
||
recuadro(25,10,53,15,1);
|
||
}
|
||
//BORRA DE LA LISTA
|
||
INFO * borrar(INFO *plista)
|
||
{
|
||
int encontrado=0;
|
||
char nombre[20],apodo[20];
|
||
INFO *p,*pant;
|
||
recuadro(25,10,55,14,2);
|
||
marco(25,10,55,14);
|
||
gotoxy(27,11);
|
||
cprintf("Introduce nombre:");
|
||
captura(10,0,nombre,44,11);
|
||
gotoxy(27,12);
|
||
cprintf("Introduce apodo:");
|
||
captura(10,0,apodo,43,12);
|
||
p=plista;
|
||
pant=0;
|
||
while(strcmp(nombre,p->nombre)!=0&&strcmp(apodo,p->apodo)!=0&&(p!=NULL))
|
||
{
|
||
pant=p;
|
||
p=p->sig;
|
||
encontrado=0;
|
||
}
|
||
if(strcmp(nombre,p->nombre)==0&&strcmp(apodo,p->apodo)==0)
|
||
{
|
||
if(pant==0) {plista=p->sig;free(p);}
|
||
pant->sig=p->sig;
|
||
free(p);
|
||
encontrado=1;
|
||
}
|
||
if(encontrado==0) {gotoxy(27,13);cprintf("no se encontro");}
|
||
else {gotoxy(27,13);cprintf("nombre borrado");}
|
||
while(!kbhit())
|
||
{
|
||
hora();
|
||
}
|
||
fflush(stdin);
|
||
textattr(7);
|
||
recuadro(25,10,56,15,1);
|
||
return plista;
|
||
}
|
||
//MUESTRA EL CONTENIDO
|
||
void contenido(INFO *plista)
|
||
{
|
||
int a,c=0;
|
||
INFO *lista;
|
||
recuadro(2,2,79,24,0);
|
||
marco(2,2,79,24);
|
||
lista=plista;
|
||
while(lista->sig!=NULL)
|
||
{
|
||
c++;
|
||
gotoxy(5,c+2);
|
||
cprintf("Nombre:%15s Apodo:%15s Numero:%15s",lista->nombre,lista->apodo,
|
||
lista->numero);
|
||
if(c==20)
|
||
{
|
||
c=0;gotoxy(37,24);printf("[PULSE TECLA]");
|
||
while(!kbhit())
|
||
{
|
||
hora();
|
||
}
|
||
while( kbhit() ) getch();
|
||
// fflush(stdin);
|
||
textattr(LIGHTGRAY);
|
||
recuadro(3,3,78,23,0);textattr(127);}
|
||
lista=lista->sig;
|
||
}
|
||
while(!kbhit())
|
||
{
|
||
hora();
|
||
}
|
||
fflush(stdin);
|
||
textattr(LIGHTGRAY);
|
||
recuadro(2,2,79,24,1);
|
||
}
|
||
//BUSCA EL NOMBRE DE UNA PERSONA
|
||
void busca(INFO *plista)
|
||
{
|
||
char cadena[20];
|
||
int a,b=0,c=0;
|
||
INFO *lista;
|
||
lista=plista;
|
||
recuadro(2,2,79,24,0);
|
||
marco(2,2,79,24);
|
||
gotoxy(4,3);
|
||
cprintf("Nombre a buscar:");
|
||
captura(10,0,cadena,20,3);
|
||
while(lista->sig!=NULL)
|
||
{
|
||
if(c==20)
|
||
{c=0;gotoxy(37,24);cprintf("[PULSE UNA TECLA]");
|
||
while(!kbhit())
|
||
{
|
||
hora();
|
||
}
|
||
fflush(stdin);recuadro(2,2,79,24,0);}
|
||
if(strcmp(cadena,lista->nombre)==0)
|
||
{
|
||
gotoxy(4,c+5);
|
||
cprintf("\nApodo:%15s Numero:%15s",lista->apodo,lista->numero);
|
||
b=1;
|
||
c++;
|
||
}
|
||
lista=lista->sig;
|
||
}
|
||
if(b==0) {gotoxy(4,4);cprintf("Nombre no encontrado");}
|
||
while(!kbhit())
|
||
{
|
||
hora();
|
||
}
|
||
fflush(stdin);
|
||
textattr(7);
|
||
recuadro(2,2,79,24,1);
|
||
}
|
||
//RECUPERA
|
||
INFO * recupera()
|
||
{
|
||
FILE *fp;
|
||
INFO *lista,*plista;
|
||
fp=fopen("tel.dat","rb");
|
||
fread(&datos,sizeof(datos),1,fp);
|
||
lista=(INFO *)malloc(sizeof(INFO));
|
||
plista=lista;
|
||
strcpy(lista->nombre,datos.nombre);
|
||
strcpy(lista->apodo,datos.apodo);
|
||
strcpy(lista->numero,datos.numero);
|
||
while(!feof(fp))
|
||
{
|
||
fread(&datos,sizeof(datos),1,fp);
|
||
lista->sig=(INFO *)malloc(sizeof(INFO));
|
||
lista=lista->sig;
|
||
strcpy(lista->nombre,datos.nombre);
|
||
strcpy(lista->apodo,datos.apodo);
|
||
strcpy(lista->numero,datos.numero);
|
||
}
|
||
lista->sig=NULL;
|
||
fclose(fp);
|
||
return plista;
|
||
}
|
||
/////////////////////////////////DIARIO//////////////////////////////////////
|
||
void diario(int subopcion)
|
||
{
|
||
LET *pletra;
|
||
switch(subopcion)
|
||
{
|
||
case 1:pletra=introduceag();break;
|
||
case 2:visualizaag();break;
|
||
}
|
||
}
|
||
//INTRODUCE AGENDA
|
||
LET * introduceag(void)
|
||
{
|
||
long int indice;
|
||
struct date d;
|
||
int x=3,y=3;
|
||
char a;
|
||
FILE *fp,*fp1;
|
||
LET *letra,*letrant,*pletra;
|
||
recuadro(2,2,79,24,0);
|
||
marco(2,2,79,24);
|
||
letra=(LET *)malloc(sizeof(LET));
|
||
pletra=letra;
|
||
letra->ant=NULL;
|
||
while(a!='\x1B')
|
||
{
|
||
x++;
|
||
if(x==79) {x=3;y=y+1;}
|
||
if(x==3&&y>3&&letra->letra=='\b') {x=79;y=y-1;}
|
||
if(y==20)
|
||
{
|
||
gotoxy(37,24);cprintf("[PULSE UNA TECLA]");
|
||
while(!kbhit())
|
||
{
|
||
hora();
|
||
}
|
||
fflush(stdin);
|
||
textattr(7);recuadro(3,3,78,23,0);textattr(127);x=3;y=3;
|
||
}
|
||
while(!kbhit())
|
||
{
|
||
hora();
|
||
}
|
||
a=getch();
|
||
gotoxy(x,y);
|
||
cprintf("%c",a);
|
||
letra->letra=a;
|
||
letrant=letra;
|
||
letra->sig=(LET *)malloc(sizeof(LET));
|
||
if(letra->letra=='\b'&&y>2&&x>3)
|
||
{
|
||
gotoxy(x-1,y);cprintf(" ");x=x-2;
|
||
letra->sig=NULL;
|
||
letra=letra->ant;
|
||
}
|
||
else if(letra->letra=='\b'&&y>2&&x==3) {x=2;}
|
||
else {
|
||
letra=letra->sig;
|
||
letra->ant=letrant;
|
||
}
|
||
}
|
||
letra->sig=NULL;
|
||
textattr(7);
|
||
recuadro(2,2,79,24,1);
|
||
fp=fopen("agenda.dat","ab");
|
||
fp1=fopen("indiceag.dat","ab");
|
||
letra=pletra;
|
||
getdate(&d);
|
||
indice=ftell(fp);
|
||
fwrite(&d,sizeof(d),1,fp1);
|
||
fwrite(&indice,sizeof(long int),1,fp1);
|
||
fwrite(&d,sizeof(d),1,fp);
|
||
while(letra->sig!=NULL)
|
||
{
|
||
simbolo.letra=letra->letra;
|
||
fwrite(&simbolo.letra,sizeof(simbolo),1,fp);
|
||
letra=letra->sig;
|
||
}
|
||
fclose(fp);
|
||
fclose(fp1);
|
||
return pletra;
|
||
}
|
||
//VISUALIZA AGENDA
|
||
void visualizaag(void)
|
||
{
|
||
char pegote[10];
|
||
struct date d;
|
||
long int indice;
|
||
int dia,mes,ano;
|
||
long int longitud;
|
||
int x=3,y=4,encontrado=0;
|
||
FILE *fp,*fp1;
|
||
LET *letra,*pletra,*letrant;
|
||
recuadro(2,2,79,24,0);
|
||
marco(2,2,79,24);
|
||
gotoxy(4,3);
|
||
cprintf("Dia:");
|
||
captura(2,1,pegote,8,3);
|
||
dia=matriz1;
|
||
gotoxy(14,3);
|
||
cprintf("Mes:");
|
||
captura(2,1,pegote,18,3);
|
||
mes=matriz1;
|
||
gotoxy(24,3);
|
||
cprintf("A<EFBFBD>o:");
|
||
captura(4,1,pegote,28,3);
|
||
ano=matriz1;
|
||
letra=(LET *)malloc(sizeof(LET));
|
||
fp=fopen("agenda.dat","rb");
|
||
fp1=fopen("indiceag.dat","rb");
|
||
while(!feof(fp1)&&encontrado==0)
|
||
{
|
||
fread(&d,sizeof(d),1,fp1);
|
||
fread(&indice,sizeof(long int),1,fp1);
|
||
if(dia==d.da_day&&mes==d.da_mon&&ano==d.da_year)
|
||
{
|
||
longitud=indice;
|
||
encontrado=1;
|
||
}
|
||
}
|
||
if(longitud!=-1)
|
||
{
|
||
fseek(fp,longitud+4,SEEK_SET);
|
||
pletra=letra;
|
||
fread(&simbolo.letra,sizeof(simbolo),1,fp);
|
||
letra->letra=simbolo.letra;
|
||
letra->ant=NULL;
|
||
fread(&simbolo.letra,sizeof(simbolo),1,fp);
|
||
while(simbolo.letra!='\x1B')
|
||
{
|
||
letrant=letra;
|
||
letra->sig=(LET *)malloc(sizeof(LET));
|
||
letra=letra->sig;
|
||
letra->letra=simbolo.letra;
|
||
letra->ant=letrant;
|
||
fread(&simbolo.letra,sizeof(simbolo),1,fp);
|
||
}
|
||
letra->sig=NULL;
|
||
letra=pletra;
|
||
while(letra->sig!=NULL)
|
||
{
|
||
x++;
|
||
if(x==79) {x=3;y=y+1;}
|
||
if(y==20)
|
||
{gotoxy(37,24);cprintf("[PULSE UNA TECLA]");
|
||
while(!kbhit())
|
||
{
|
||
hora();
|
||
}
|
||
fflush(stdin);
|
||
textattr(7);recuadro(3,3,78,23,0);textattr(127);x=3;y=3;}
|
||
gotoxy(x,y);
|
||
cprintf("%c",letra->letra);
|
||
letra=letra->sig;
|
||
}
|
||
x++;
|
||
if(x==79) {x=3;y=y+1;}
|
||
gotoxy(x,y);
|
||
cprintf("%c",letra->letra);
|
||
}
|
||
while(!kbhit())
|
||
{
|
||
hora();
|
||
}
|
||
fflush(stdin);
|
||
textattr(7);
|
||
recuadro(2,2,79,24,1);
|
||
fclose(fp);
|
||
fclose(fp1);
|
||
}
|
||
///////////////////////////////////CAPTURA///////////////////////////////////
|
||
void captura(int tam,int elec,char nombre[73],int x,int y)
|
||
{
|
||
int i=0,c=0,c1=0;
|
||
matriz1=0;
|
||
if(elec==0)
|
||
{ do
|
||
{
|
||
while(!kbhit())
|
||
{
|
||
hora();
|
||
}
|
||
matriz2[i]=getch();
|
||
matriz2[i]=toupper(matriz2[i]);
|
||
if(matriz2[i]=='\b')
|
||
{
|
||
c--;
|
||
if(c==-1) c=0;
|
||
i--;
|
||
if(i==-1) i=0;
|
||
gotoxy(x+i,y);
|
||
cprintf(" ");
|
||
}
|
||
else
|
||
{
|
||
if ((isalpha(matriz2[i])!=0||matriz2[i]==' '||matriz2[i]=='<EFBFBD>'||matriz2[i]=='<EFBFBD>')&&(c!=tam))
|
||
{
|
||
gotoxy(x+i,y);
|
||
cprintf("%c",matriz2[i]);
|
||
i++;
|
||
c++;
|
||
}
|
||
}
|
||
}while(matriz2[i]!='\r');
|
||
matriz2[i]='\0';
|
||
strcpy(nombre,matriz2);
|
||
}
|
||
else { do
|
||
{
|
||
while(!kbhit())
|
||
{
|
||
hora();
|
||
}
|
||
matriz2[i]=getch();
|
||
matriz2[i]=toupper(matriz2[i]);
|
||
if(matriz2[i]=='\b')
|
||
{
|
||
c--;
|
||
if(c==-1) c=0;
|
||
i--;
|
||
if(i==-1) i=0;
|
||
gotoxy(x+i,y);
|
||
cprintf(" ");
|
||
}
|
||
else
|
||
{
|
||
if (c!=tam&&matriz2[i]!='\r')
|
||
{
|
||
gotoxy(x+i,y);
|
||
cprintf("%c",matriz2[i]);
|
||
i++;
|
||
c++;
|
||
}
|
||
}
|
||
}while(matriz2[i]!='\r');
|
||
matriz2[i]='\0';
|
||
strcpy(nombre,matriz2);
|
||
}
|
||
if (elec==1)
|
||
{
|
||
c1=i;
|
||
while(c1!=0)
|
||
{
|
||
c1--;
|
||
matriz1=matriz1+((matriz2[c1])-48)*(pow(10,i-c1-1));
|
||
}
|
||
}
|
||
|
||
}
|
||
/*
|
||
//CAPTURA
|
||
void captura(int tam, char intochar,char nombre[30],int x,int y)
|
||
{
|
||
int i=0,c=0,c1=0;
|
||
matriz1=0;
|
||
if (intochar=='i')
|
||
{
|
||
do
|
||
{
|
||
matriz2[i]=getch();
|
||
if(matriz2[i]=='\b')
|
||
{
|
||
c--;
|
||
if(c==-1) c=0;
|
||
i--;
|
||
if(i==-1) i=0;
|
||
gotoxy(x+i,y);
|
||
cprintf(" ");
|
||
}
|
||
else
|
||
{
|
||
if (isdigit(matriz2[i])!=0&&(c!=tam))
|
||
{
|
||
gotoxy(x+i,y);
|
||
cprintf("%c",matriz2[i]);
|
||
i++;
|
||
c++;
|
||
}
|
||
}
|
||
}
|
||
while(matriz2[i]!='\r');
|
||
matriz2[i]='\0';
|
||
}
|
||
if (intochar=='c')
|
||
{
|
||
do
|
||
{
|
||
matriz2[i]=getch();
|
||
matriz2[i]=toupper(matriz2[i]);
|
||
if(matriz2[i]=='\b')
|
||
{
|
||
c--;
|
||
if(c==-1) c=0;
|
||
i--;
|
||
if(i==-1) i=0;
|
||
gotoxy(x+i,y);
|
||
cprintf(" ");
|
||
}
|
||
else
|
||
{
|
||
if ((isalpha(matriz2[i])!=0||matriz2[i]==' '||matriz2[i]=='<27>'||matriz2[i]=='<27>')&&(c!=tam))
|
||
{
|
||
gotoxy(x+i,y);
|
||
cprintf("%c",matriz2[i]);
|
||
i++;
|
||
c++;
|
||
}
|
||
}
|
||
}while(matriz2[i]!='\r');
|
||
matriz2[i]='\0';
|
||
}
|
||
if (intochar=='i')
|
||
{
|
||
c1=i;
|
||
while(c1!=0)
|
||
{
|
||
c1--;
|
||
matriz1=matriz1+((matriz2[c1])-48)*(pow(10,i-c1-1));
|
||
}
|
||
}
|
||
else strcpy(nombre,matriz2);
|
||
|
||
}*/
|