commit 0f24b3477e1158eb32981987c9efae8e8a1484d0 Author: jdg Date: Sun Sep 12 19:50:38 2021 +0200 First commit 16/08/1996 diff --git a/AGENDA.CPP b/AGENDA.CPP new file mode 100644 index 0000000..286c054 --- /dev/null +++ b/AGENDA.CPP @@ -0,0 +1,836 @@ +//BIBLIOTECAS EMPLEADAS +//Bibliotecas +#include +#include +#include +#include +#include +#include +#include +#include + +//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("Û"); + else cprintf("²"); + } +if(o==2) + { + textattr(0); + for(a=y+1;asig!=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¤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]=='¤'||matriz2[i]=='¥')&&(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]=='¤'||matriz2[i]=='¥')&&(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); + +}*/ diff --git a/AGENDA.DAT b/AGENDA.DAT new file mode 100644 index 0000000..c768c1a --- /dev/null +++ b/AGENDA.DAT @@ -0,0 +1 @@ +Î \ No newline at end of file diff --git a/AGENDA.EXE b/AGENDA.EXE new file mode 100644 index 0000000..9da3825 Binary files /dev/null and b/AGENDA.EXE differ diff --git a/AGENDA.PIF b/AGENDA.PIF new file mode 100644 index 0000000..0d892cb Binary files /dev/null and b/AGENDA.PIF differ diff --git a/AGENDA1.CPP b/AGENDA1.CPP new file mode 100644 index 0000000..ce4d22e --- /dev/null +++ b/AGENDA1.CPP @@ -0,0 +1,851 @@ +//BIBLIOTECAS EMPLEADAS +//Bibliotecas +#include +#include +#include +#include +#include +#include +#include +#include + +//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; +int opcion=1; +INFO *plista=NULL; +char matriz2[80]; + +//DECLARACION DE FUNCIONES +void graba(); +void diario(int subopcion); +void captura(int tam,int elec,char nombre[80],int x,int y); +void telefonos(int subopcion); +void recupera(); +void introducir(); +void borrar(); +void contenido(); +void busca(); +void visualizadag(void); +void visualizaag(void); +LET * introduceag(void); +void hora(void); +void creditos(void); +void dibujaeleccion(); +void dibujasubmenu1(); +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 a=0; +recupera(); +clrscr(); +textbackground(0); +_setcursortype(_NOCURSOR); +menu(); +while(opcion!=4||a!=7181) + { + dibujaeleccion(); + while(!kbhit()) + { + hora(); + } + a=bioskey(0); + if(a==7181&&opcion!=4) dibujasubmenu1(); + if(a==19712) opcion++; + if(a==19200) opcion--; + if(opcion==0) opcion=4; + if(opcion==5) opcion=1; + } +graba(); +_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() +{ +textattr(LIGHTGRAY); +textattr(127); +gotoxy(3,1); +cprintf(" DIARIO TELEFONOS INFORMACION FINALIZAR"); +gotoxy(3,25); +cprintf("Copyrights() o derechos de copia()"); +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 +void dibujasubmenu1() +{ +//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,20,6,2); + marco(5,2,20,6); + while(a!=7181&&a!=283&&a!=19712&&a!=19200) + { + textattr(127); + gotoxy(7,3);cprintf(" INTRODUCIR "); + gotoxy(7,4);cprintf("VER DIA AG."); + gotoxy(7,5);cprintf("VER TODA AG."); + textattr(LIGHTGRAY); + switch(subopcion1) + { + case 1: gotoxy(7,3);cprintf(" INTRODUCIR ");break; + case 2: gotoxy(7,4);cprintf("VER DIA AG.");break; + case 3: gotoxy(7,5);cprintf("VER TODA AG.");break; + } + while(!kbhit()) + { + hora(); + } + a=bioskey(0); + if(a==20480) subopcion1++; + if(a==18432) subopcion1--; + if(subopcion1==0) subopcion1=3; + if(subopcion1==4) subopcion1=1; + } + if(a!=283&&a!=19712&&a!=19200) diario(subopcion1); + textattr(LIGHTGRAY);recuadro(5,2,21,7,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(a==19712) {a=0;opcion++;} +if(a==19200) {a=0;opcion--;} +if(opcion==0) opcion=4; +if(opcion==5) opcion=1; +dibujaeleccion(); +} +} + + +//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("Û"); + else cprintf("²"); + } +if(o==2) + { + textattr(0); + for(a=y+1;asig!=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 +void borrar() +{ +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); +} +//MUESTRA EL CONTENIDO +void contenido() +{ +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() +{ +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 +void recupera() +{ +FILE *fp; +INFO *lista; +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); +} +/////////////////////////////////DIARIO////////////////////////////////////// +void diario(int subopcion) +{ +switch(subopcion) + { + case 1:introduceag();break; + case 2:visualizadag();break; + case 3: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","a+b"); +fp1=fopen("indiceag.dat","a+b"); +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 DE UN DIA EN CONCRETO +void visualizadag(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¤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); +} +//VISUALIZA AGENDA DESDE EL PRINCIPIO [intento] +void visualizaag(void) +{ +char pegote[10]; +struct date d; +long int indice; +int dia,mes,ano; +long int longitud=0; +int x=3,y=4; +FILE *fp,*fp1; +LET *letra,*pletra,*letrant; +recuadro(2,2,79,24,0); +marco(2,2,79,24); +letra=(LET *)malloc(sizeof(LET)); +fp=fopen("agenda.dat","rb"); +fp1=fopen("indiceag.dat","rb"); +//crea lista +while(!feof(fp1)) //if(longitud!=-1) +{ +fread(&d,sizeof(d),1,fp1); +fread(&indice,sizeof(long int),1,fp1); +fseek(fp, indice/*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)) ); +// if ( letra->sig == NULL ) NO MEMORIA + + + letra=letra->sig; + letra->letra=simbolo.letra; + letra->ant=letrant; + fread(&simbolo.letra,sizeof(simbolo),1,fp); + } +letra->sig=NULL; +letra=pletra; +gotoxy(3,3); +cprintf("dia:%i mes:%i a¤o:%i",d.da_day,d.da_mon,d.da_year); +//imprime contenido +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); +x=3; +y=3; +getch(); +recuadro(3,3,78,23,0); +textattr(7); +} +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]=='¤'||matriz2[i]=='¥')&&(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)); + } + } + +} +////////////////////////////GRABANDO DATOS ANTES DE SALIR///////////////////// +void graba() +{ +INFO *lista; +FILE *fp; +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); + strupr(datos.nombre); + strupr(datos.apodo); + fwrite(&datos,sizeof(datos),1,fp); + lista=lista->sig; + } +fclose(fp); +} \ No newline at end of file diff --git a/AGENDA1.EXE b/AGENDA1.EXE new file mode 100644 index 0000000..b13325c Binary files /dev/null and b/AGENDA1.EXE differ diff --git a/AHORCADO.CPP b/AHORCADO.CPP new file mode 100644 index 0000000..8a804a2 --- /dev/null +++ b/AHORCADO.CPP @@ -0,0 +1,101 @@ + +#include +#include +#include +#include + +void dibujo(int a) +{ int i; +textcolor(9); +switch(a) +{ + case 1: + gotoxy(50,10); + cprintf("-------"); + break; + case 2: + for(i=9;i>5;i--) + { + gotoxy(53,i); + cprintf("|"); + } + break; + case 3: + gotoxy(53,5); + cprintf("-------"); + break; + case 4: + gotoxy(60,6); + cprintf("|"); + break; + case 5: + gotoxy(60,7); + cprintf(""); + + } + } + + + + + + + + + + + + + + +void main() +{ +char palabra[6][10]={"casa","cuaderno","pescado","ordenador","alfombra"}; +char pala; +int i,j,c1=0,c1a,c2=0,l,x; + +clrscr(); +randomize(); +x=rand() %5; +l=strlen(palabra[x]); + +for(i=0;i +#include +#include +#include +#include +#include +#include +#include +#include +#define color1 7 +#define color2 127 + +//VARIABLES GLOBALES +struct datos{ char apellidos[21]; + char nombre[16]; + char direccion[21]; + char localidad[21]; + char provincia[11]; + char cod_postal[6]; + char edad[3]; + char tfno[10]; + char dni[10]; + char instrumento[11]; + }datos; + +typedef struct nodo{ char apellidos[21]; + char nombre[16]; + char direccion[21]; + char localidad[21]; + char provincia[11]; + char cod_postal[6]; + char edad[3]; + char tfno[10]; + char dni[10]; + char instrumento[11]; + struct nodo *sig; + }PERSONAS; + +struct simbolo{ char letra; + + }simbolo; + +typedef struct nodo1{ char letra; + struct nodo1 *sig; + struct nodo1 *ant; + + }LET; +int matriz1=0; +int opcion=1; +PERSONAS *plista=NULL; +char matriz2[80]; + +//DECLARACION DE FUNCIONES +void graba(); +void diario(int subopcion); +void captura(int tam,int elec,char nombre[80],int x,int y); +void MUSICOS(int subopcion); +void recupera(); +void introducir(); +void borrar(); +void contenido(); +void busca(); +void visualizadag(void); +void visualizaag(char nombre[8]); +LET * introduceag(char nombre[8]); +void hora(void); +void creditos(void); +void dibujaeleccion(); +void dibujasubmenu1(); +void recuadro(int x,int y,int x1,int y1,int o); +void marco(int x,int y,int x1,int y1); +void ayudas(); +void menu(void); + +//FUNCION PRINCIPAL +void main() +{ +int a=0; +recupera(); +clrscr(); +textbackground(0); +_setcursortype(_NOCURSOR); +menu(); +while(opcion!=6||a!=7181) + { + dibujaeleccion(); + while(!kbhit()) + { + hora(); + } + a=bioskey(0); + if(a==7181&&opcion!=6) dibujasubmenu1(); + if(a==19712) opcion++; + if(a==19200) opcion--; + if(opcion==0) opcion=6; + if(opcion==7) opcion=1; + } +graba(); +//system("copy indiceag.dat indiceag.seg"); +//system("copy agenda.dat agenda.seg"); +//system("copy tel.dat tel.seg"); +_setcursortype(_NORMALCURSOR); +textbackground(0); +clrscr(); +} + +//DIBUJA EL INTERFAZ GENERAL +void menu() +{ +clrscr(); +textattr(color1); +recuadro(2,2,79,24,1); +recuadro(2,1,79,1,0); +recuadro(2,25,79,25,0); +} + +//DIBUJA ELECCION +void dibujaeleccion() +{ +//textattr(LIGHTGRAY); +textattr(color2); +gotoxy(5,1); +cprintf("Actuaciones Musicos Organismos Archivos Informacion Salir"); +gotoxy(3,25); +cprintf("Copyrights() o derechos de copia()"); +textattr(color1); +switch(opcion) + { + case 1:gotoxy(5,1);cprintf("Actuaciones");break; + case 2:gotoxy(20,1);cprintf("Musicos");break; + case 3:gotoxy(31,1);cprintf("Organismos");break; + case 4:gotoxy(45,1);cprintf("Archivos");break; + case 5:gotoxy(57,1);cprintf("Informacion");break; + case 6:gotoxy(72,1);cprintf("Salir");break; + } +} + +//DIBUJA SUBMENUS +void dibujasubmenu1() +{ +//subopcion son CURSOS,subopcion1 son CLASES DE CURSOS +//subopcion son eleccion de submenus +int a=0,subopcion1=1,subopcion2=1,subopcion3=1; +int subopcion4=1,subopcion41=1,subopcion42=1,subopcion5=1; +while(a!=7181&&a!=283) +{ +switch(opcion) + { + case 1: //ACTUACIONES + recuadro(5,2,20,7,2); + marco(5,2,19,7); + while(a!=7181&&a!=283&&a!=19712&&a!=19200) + { + textattr(color2); + gotoxy(7,3);cprintf("Toros"); + gotoxy(7,4);cprintf("Procesiones"); + gotoxy(7,5);cprintf("Conciertos"); + gotoxy(7,6);cprintf("Varios"); + textattr(color1); + switch(subopcion1) + { + case 1: gotoxy(7,3);cprintf("Toros");break; + case 2: gotoxy(7,4);cprintf("Procesiones");break; + case 3: gotoxy(7,5);cprintf("Conciertos");break; + case 4: gotoxy(7,6);cprintf("Varios");break; + } + while(!kbhit()) + { + hora(); + } + a=bioskey(0); + if(a==20480) subopcion1++; + if(a==18432) subopcion1--; + if(subopcion1==0) subopcion1=4; + if(subopcion1==5) subopcion1=1; + } + if(a!=283&&a!=19712&&a!=19200) diario(subopcion1); + textattr(color1);recuadro(5,2,21,8,1); + break; + case 2: //MUSICOS + recuadro(20,2,33,7,2); + marco(20,2,33,7); + while(a!=7181&&a!=283&&a!=19712&&a!=19200) + { + textattr(color2); + gotoxy(22,3);cprintf("Introducir"); + gotoxy(22,4);cprintf("Ver lista"); + gotoxy(22,5);cprintf("Borrar"); + gotoxy(22,6);cprintf("Buscar"); + textattr(color1); + switch(subopcion2) + { + case 1: gotoxy(22,3);cprintf("Introducir");break; + case 2: gotoxy(22,4);cprintf("Ver lista");break; + case 3: gotoxy(22,5);cprintf("Borrar");break; + case 4: gotoxy(22,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) + { + MUSICOS(subopcion2); + } + textattr(color1);recuadro(20,2,34,8,1); + break; + case 3: //ORGANISMOS + recuadro(31,2,45,8,2); + marco(31,2,45,8); + while(a!=7181&&a!=283&&a!=19712&&a!=19200) + { + textattr(color2); + gotoxy(33,3);cprintf("Oficiales"); + gotoxy(33,4);cprintf("Hermandades"); + gotoxy(33,5);cprintf("Toros"); + gotoxy(33,6);cprintf("Entidades"); + gotoxy(33,7);cprintf("Varios"); + textattr(color1); + switch(subopcion3) + { + case 1: gotoxy(33,3);cprintf("Oficiales");break; + case 2: gotoxy(33,4);cprintf("Hermandades");break; + case 3: gotoxy(33,5);cprintf("Toros");break; + case 4: gotoxy(33,6);cprintf("Entidades");break; + case 5: gotoxy(33,7);cprintf("Varios");break; + + } + while(!kbhit()) + { + hora(); + } + a=bioskey(0); + if(a==20480) subopcion3++; + if(a==18432) subopcion3--; + if(subopcion3==0) subopcion3=5; + if(subopcion3==6) subopcion3=1; + } + textattr(color1);recuadro(31,2,46,9,1); + break; + case 4://ARCHIVOS + recuadro(45,2,64,7,2); + marco(45,2,64,7); + while(a!=7181&&a!=283&&a!=19712&&a!=19200) + { + textattr(color2); + gotoxy(47,3);cprintf("Marchas"); + gotoxy(47,4);cprintf("Paso dobles"); + gotoxy(47,5);cprintf("Obras/Concientos"); + gotoxy(47,6);cprintf("Varios"); + textattr(color1); + switch(subopcion4) + { + case 1: gotoxy(47,3);cprintf("Marchas");break; + case 2: gotoxy(47,4);cprintf("Paso dobles");break; + case 3: gotoxy(47,5);cprintf("Obras/Conciertos");break; + case 4: gotoxy(47,6);cprintf("Varios");break; + } + while(!kbhit()) + { + hora(); + } + a=bioskey(0); + if(a==20480) subopcion4++; + if(a==18432) subopcion4--; + if(subopcion4==0) subopcion4=4; + if(subopcion4==5) subopcion4=1; + } + if(a!=283&&a!=19712&&a!=19200) + { + a=0; + if (subopcion4==1) + { + recuadro(65,2,77,5,2); + marco(65,2,77,5); + while(a!=7181&&a!=283&&a!=19712&&a!=19200) + { + textattr(color2); + gotoxy(66,3);cprintf("Militares"); + gotoxy(66,4);cprintf("Procesiones"); + textattr(color1); + switch(subopcion41) + { + case 1: gotoxy(66,3);cprintf("Militares");break; + case 2: gotoxy(66,4);cprintf("Procesiones");break; + } + while(!kbhit()) + { + hora(); + } + a=bioskey(0); + if(a==20480) subopcion41++; + if(a==18432) subopcion41--; + if(subopcion41==0) subopcion41=2; + if(subopcion41==3) subopcion41=1; + } + textattr(color1);recuadro(65,2,78,6,1); + dibujasubmenu1(); + } + if (subopcion4==2) + { + recuadro(65,2,76,5,2); + marco(65,2,76,5); + while(a!=7181&&a!=283&&a!=19712&&a!=19200) + { + textattr(color2); + gotoxy(66,3);cprintf("Toros"); + gotoxy(66,4);cprintf("Conciertos"); + textattr(color1); + switch(subopcion42) + { + case 1: gotoxy(66,3);cprintf("Toros");break; + case 2: gotoxy(66,4);cprintf("Conciertos");break; + } + while(!kbhit()) + { + hora(); + } + a=bioskey(0); + if(a==20480) subopcion42++; + if(a==18432) subopcion42--; + if(subopcion42==0) subopcion42=2; + if(subopcion42==3) subopcion42=1; + } + textattr(color1);recuadro(65,2,78,6,1); + dibujasubmenu1(); + } + } + textattr(color1);recuadro(45,2,65,8,1); + break; + case 5: //INFORMACION + recuadro(57,2,68,5,2); + marco(57,2,68,5); + while(a!=7181&&a!=283&&a!=19712&&a!=19200) + { + textattr(color2); + gotoxy(59,3);cprintf("Ayuda"); + gotoxy(59,4);cprintf("Creditos"); + textattr(color1); + switch(subopcion5) + { + case 1: gotoxy(59,3);cprintf("Ayuda");break; + case 2: gotoxy(59,4);cprintf("Creditos");break; + } + while(!kbhit()) + { + hora(); + } + a=bioskey(0); + if(a==20480) subopcion5++; + if(a==18432) subopcion5--; + if(subopcion5==0) subopcion5=2; + if(subopcion5==3) subopcion5=1; + } + if(subopcion5==1&&a!=283&&a==7181) ayudas(); + else if(a!=283&&a==7181/*a!=19712&&a!=19200*/) creditos(); + //if(a!=283&&a!=19712&&a!=19200) + // { + // MUSICOS(subopcion2); + // } + textattr(color1);recuadro(57,2,69,6,1); + break; + + case 6: //SALIR + while(!kbhit()) + { + hora(); + } + a=bioskey(0); + break; + } +if(a==19712) {a=0;opcion++;} +if(a==19200) {a=0;opcion--;} +if(opcion==0) opcion=6; +if(opcion==7) opcion=1; +dibujaeleccion(); +} +} +//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(color1); +for(a=x;a!=x1+1;a++) + for(b=y;b!=y1+1;b++) + { + gotoxy(a,b); + if(o==0||o==2) cprintf("Û"); + else cprintf("²"); + } +if(o==2) + { + textattr(0); + for(a=y+1;asig!=NULL) + { + lista=lista->sig; + } +lista->sig=(PERSONAS *)malloc(sizeof(PERSONAS)); +gotoxy(10,6); +cprintf("Apellidos:"); +gotoxy(41,6); +cprintf("Nombre:"); +gotoxy(10,8); +cprintf("Direccion:"); +gotoxy(10,10); +cprintf("Localidad:"); +gotoxy(41,10); +cprintf("Provincia:"); +gotoxy(10,12); +cprintf("C.P.:"); +gotoxy(36,12); +cprintf("Edad:"); +gotoxy(51,12); +cprintf("Tfno:"); +gotoxy(10,14); +cprintf("DNI:"); +gotoxy(36,14); +cprintf("Instrumento:"); +captura(20,2,lista->apellidos,20,6); +captura(15,2,lista->nombre,48,6); +captura(20,2,lista->direccion,20,8); +captura(20,2,lista->localidad,20,10); +captura(10,2,lista->provincia,51,10); +captura(5,2,lista->cod_postal,16,12); +captura(2,2,lista->edad,41,12); +captura(9,2,lista->tfno,56,12); +captura(9,2,lista->dni,14,14); +captura(10,2,lista->instrumento,48,14); +lista=lista->sig; +lista->sig=NULL; +textattr(color1); +recuadro(9,5,69,20,1); +/*gotoxy(27,11); +cprintf("Nombre:"); +captura(10,1,lista->nombre,34,11); +gotoxy(27,12); +cprintf("Apodo:"); +captura(11,1,lista->apodo,33,12); +gotoxy(27,13); +cprintf("Numero:"); +captura(10,1,lista->numero,34,13);*/ +//textattr(color1); +//recuadro(25,10,53,15,1); +} +/*//METE DATOS +void introducir() +{ +PERSONAS datos; +FILE *fp; +if ((fp=fopen("musico.dat","ab"))==NULL) fp=fopen("musico.dat","wb"); +recuadro(9,5,68,19,2); +marco(9,5,68,19); +gotoxy(10,6); +cprintf("Apellidos:"); +gotoxy(41,6); +cprintf("Nombre:"); +gotoxy(10,8); +cprintf("Direccion:"); +gotoxy(10,10); +cprintf("Localidad:"); +gotoxy(41,10); +cprintf("Provincia:"); +gotoxy(10,12); +cprintf("C.P.:"); +gotoxy(36,12); +cprintf("Edad:"); +gotoxy(51,12); +cprintf("Tfno:"); +gotoxy(10,14); +cprintf("DNI:"); +gotoxy(36,14); +cprintf("Instrumento:"); +captura(20,2,datos.apellidos,20,6); +captura(15,2,datos.nombre,48,6); +captura(20,2,datos.direccion,20,8); +captura(20,2,datos.localidad,20,10); +captura(10,2,datos.provincia,51,10); +captura(5,2,datos.cod_postal,16,12); +captura(2,2,datos.edad,41,12); +captura(9,2,datos.tfno,56,12); +captura(9,2,datos.dni,14,14); +captura(10,2,datos.instrumento,48,14); +textattr(LIGHTGRAY); +recuadro(9,5,69,20,1); +fwrite(&datos,sizeof(datos),1,fp); +fclose(fp); +}*/ +//BORRA DE LA LISTA +void borrar() +{ +int encontrado=0; +char dni[9],nombre[16],apellidos[21]; +PERSONAS *p,*pant; +recuadro(18,10,62,14,2); +marco(18,10,62,14); +gotoxy(21,11); +cprintf("Introduce nombre:"); +captura(15,0,nombre,38,11); +gotoxy(21,12); +cprintf("Introduce apellidos:"); +captura(20,0,apellidos,41,12); +p=plista; +pant=0; +while(strcmp(nombre,p->nombre)!=0&&strcmp(apellidos,p->apellidos)!=0&&(p!=NULL)) + { + pant=p; + p=p->sig; + encontrado=0; + } +if(strcmp(nombre,p->nombre)==0&&strcmp(apellidos,p->apellidos)==0) + { + if(pant==0) {plista=p->sig;free(p);} + pant->sig=p->sig; + free(p); + encontrado=1; + } +if(encontrado==0) {gotoxy(21,13);cprintf("No se encontro");} +else {gotoxy(21,13);cprintf("Nombre borrado");} +while(!kbhit()) +{ +hora(); +} +fflush(stdin); +textattr(color1); +recuadro(18,10,63,15,1); +} +//r para inicio de carro +//MUESTRA EL CONTENIDO +void contenido() +{ +int a,c=0,num=1,y=2; +PERSONAS *lista; +recuadro(2,2,79,24,0); +marco(2,2,79,24); +lista=plista; +while(lista->sig!=NULL) + { + c++; + gotoxy(5,y+1); + cprintf("%d.-%s %s DNI:%s",num,lista->nombre,lista->apellidos,lista->dni); + gotoxy(8,y+2); + cprintf("%s",lista->direccion); + gotoxy(8,y+3); + cprintf("%5s %20s %10s tfno:%9s\n",lista->cod_postal,lista->localidad,lista->provincia,lista->tfno); + y=y+3; + if(c==7) + { + y=2;c=0;gotoxy(37,24);cprintf("[PULSE TECLA]"); + while(!kbhit()) + { + hora(); + } + while( kbhit() ) getch(); + textattr(color1); + recuadro(3,3,78,23,0);textattr(color2);} + lista=lista->sig; + num++; + } +if(c==0) + { + marco(23,10,60,14); + gotoxy(29,12); + cprintf("NO SE ENCONTRARON TELEFONOS"); + } +while(!kbhit()) +{ +hora(); +} +fflush(stdin); +textattr(color1); +recuadro(2,2,79,24,1); +} +/*//MUESTRA EL CONTENIDO +void contenido() +{ +int a,c=2,paso=0,num=1; +//INFO *lista; +PERSONAS datos; +FILE *fp; +fp=fopen("musico.dat","rb"); +recuadro(2,2,79,24,0); +marco(2,2,79,24); +//lista=plista; +while(!feof(fp)) + { + if (paso==1) + { + gotoxy(5,c+1); + cprintf("%d.-%s %s DNI:%s",num,datos.nombre,datos.apellidos,datos.dni); + gotoxy(8,c+2); + cprintf("%s",datos.direccion); + gotoxy(8,c+3); + cprintf("%5s %20s %10s tfno:%9s\n",datos.cod_postal,datos.localidad,datos.provincia,datos.tfno); +// lista=lista->sig; + c=c+4; + num++; + if(c==22) + { + c=2;gotoxy(37,24);cprintf("[PULSE TECLA]"); + while(!kbhit()) + { + hora(); + } + while( kbhit() ) getch(); + textattr(LIGHTGRAY); + recuadro(3,3,78,23,0);textattr(color2); + } + } + fread(&datos,sizeof(datos),1,fp); + paso=1; + } +if(c==0) + { + marco(23,10,60,14); + gotoxy(29,12); + cprintf("NO SE ENCONTRARON MUSICOS"); + } +while(!kbhit()) + { + hora(); + } +fflush(stdin); +textattr(LIGHTGRAY); +recuadro(2,2,79,24,1); +fclose(fp); +} */ +//BUSCA EL NOMBRE DE UNA PERSONA +void busca() +{ +char nombre[16],apellidos[21]; +int a,b=0,c=0; +PERSONAS *lista; +lista=plista; +recuadro(2,2,79,24,0); +marco(2,2,79,24); +gotoxy(4,3); +cprintf("Nombre:"); +captura(15,0,nombre,11,3); +gotoxy(4,4); +cprintf("Apellidos:"); +captura(20,0,apellidos,14,4); +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(nombre,lista->nombre)==0&&strcmp(apellidos,lista->apellidos)==0) + { + recuadro(9,5,68,19,2); + marco(9,5,68,19); + gotoxy(10,6); + cprintf("Apellidos:%s",datos.apellidos); + gotoxy(41,6); + cprintf("Nombre:%s",datos.nombre); + gotoxy(10,8); + cprintf("Direccion:%s",datos.direccion); + gotoxy(10,10); + cprintf("Localidad:%s",datos.localidad); + gotoxy(41,10); + cprintf("Provincia:%s",datos.provincia); + gotoxy(10,12); + cprintf("C.P.:%s",datos.cod_postal); + gotoxy(36,12); + cprintf("Edad:%s",datos.edad); + gotoxy(51,12); + cprintf("Tfno:%s",datos.tfno); + gotoxy(10,14); + cprintf("DNI:%s",datos.dni); + gotoxy(36,14); + cprintf("Instrumento:%s",datos.instrumento); + b=1; + c++; + } +lista=lista->sig; +} +if(b==0) {gotoxy(4,5);cprintf("Nombre no encontrado");} +while(!kbhit()) +{ +hora(); +} +fflush(stdin); +textattr(color1); +recuadro(2,2,79,24,1); +} +/*//BUSCA EL NOMBRE DE UNA PERSONA +void busca() +{ +char apellidos[20],nombre[15]; +int encontrado=0; +PERSONAS datos; +FILE *fp; +fp=fopen("musico.dat","rb"); +recuadro(2,2,79,24,0); +marco(2,2,79,24); +gotoxy(4,3); +cprintf("Nombre:"); +captura(15,0,nombre,20,3); +gotoxy(4,4); +cprintf("Apellidos:"); +captura(20,0,apellidos,20,4); +while(!feof(fp)&&encontrado==0) +{ +//while(!kbhit()) +// { +// hora(); +// } +fread (&datos,sizeof(datos),1,fp); +if(strcmp(nombre,datos.nombre)==0&&strcmp(apellidos,datos.apellidos)==0) + { + encontrado=1; + recuadro(9,5,68,19,2); + marco(9,5,68,19); + gotoxy(10,6); + cprintf("Apellidos:%s",datos.apellidos); + gotoxy(41,6); + cprintf("Nombre:%s",datos.nombre); + gotoxy(10,8); + cprintf("Direccion:%s",datos.direccion); + gotoxy(10,10); + cprintf("Localidad:%s",datos.localidad); + gotoxy(41,10); + cprintf("Provincia:%s",datos.provincia); + gotoxy(10,12); + cprintf("C.P.:%s",datos.cod_postal); + gotoxy(36,12); + cprintf("Edad:%s",datos.edad); + gotoxy(51,12); + cprintf("Tfno:%s",datos.tfno); + gotoxy(10,14); + cprintf("DNI:%s",datos.dni); + gotoxy(36,14); + cprintf("Instrumento:%s",datos.instrumento); + } +} +if(encontrado==0) {gotoxy(4,5);cprintf("Nombre no encontrado");} +while(!kbhit()) +{ +hora(); +} +fflush(stdin); +textattr(7); +recuadro(2,2,79,24,1); +fclose(fp); +} */ +//RECUPERA +void recupera() +{ +FILE *fp; +PERSONAS *lista; +if((fp=fopen("musico.dat","rb"))==NULL) fp=fopen("musico.dat","wb"); +else + { + fread(&datos,sizeof(datos),1,fp); + lista=(PERSONAS *)malloc(sizeof(PERSONAS)); + plista=lista; + strcpy(lista->apellidos,datos.apellidos); + strcpy(lista->nombre,datos.nombre); + strcpy(lista->direccion,datos.direccion); + strcpy(lista->localidad,datos.localidad); + strcpy(lista->provincia,datos.provincia); + strcpy(lista->cod_postal,datos.cod_postal); + strcpy(lista->edad,datos.edad); + strcpy(lista->tfno,datos.tfno); + strcpy(lista->dni,datos.dni); + strcpy(lista->instrumento,datos.instrumento); + while(!feof(fp)) + { + fread(&datos,sizeof(datos),1,fp); + lista->sig=(PERSONAS *)malloc(sizeof(PERSONAS)); + lista=lista->sig; + strcpy(lista->apellidos,datos.apellidos); + strcpy(lista->nombre,datos.nombre); + strcpy(lista->direccion,datos.direccion); + strcpy(lista->localidad,datos.localidad); + strcpy(lista->provincia,datos.provincia); + strcpy(lista->cod_postal,datos.cod_postal); + strcpy(lista->edad,datos.edad); + strcpy(lista->tfno,datos.tfno); + strcpy(lista->dni,datos.dni); + strcpy(lista->instrumento,datos.instrumento); + } + } +lista->sig=NULL; +fclose(fp); +} +/////////////////////////////////DIARIO////////////////////////////////////// +void diario(int subopcion) +{ +//char clave[20]; +//recuadro(30,10,53,14,0); +//marco(30,10,53,14); +//gotoxy(31,12); +//cprintf("CLAVE:"); +//captura(16,0,clave,37,12); +//if (strcmp(clave,"PROHIBIDOX")==0) + switch(subopcion) + { + case 1:visualizaag("toros");introduceag("toros");break; + case 2:visualizaag("proce");introduceag("proce");break; + case 3:visualizaag("conci");introduceag("conci");break; + case 4:visualizaag("vario");introduceag("vario");break; +// case 2:visualizadag();break; +// case 3:visualizaag("toros");break; + } +/*else + { + gotoxy(31,13); + cprintf("CLAVE INCORRECTA"); + getch(); + }*/ +recuadro(30,10,53,14,1); +} +//INTRODUCE AGENDA +LET * introduceag(char nombre[8]) +{ +FILE *fp,*fp1; +LET *letra,*letrant,*pletra; +long espacio; +struct date d; +int x=3,y=3; +char a='0'; +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=78;y=y-1;} + if(y==20) + { + gotoxy(37,24);cprintf("[PULSE UNA TECLA]"); + while(!kbhit()) + { + hora(); + } + textattr(color1);recuadro(3,3,78,23,0);textattr(color2);x=3;y=3; + } + gotoxy(x,y); + cprintf("±"); + 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,y);cprintf(" "); + 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(color1); +recuadro(2,2,79,24,1); +fp1=fopen("indiceag.dat","a+b"); +//fp=fopen("agenda.dat","a+b"); +fp=fopen(nombre,"a+b"); +letra=pletra; +while(letra->sig!=NULL) + { + simbolo.letra=letra->letra; + fwrite(&simbolo.letra,sizeof(simbolo),1,fp); + letra=letra->sig; + } +getdate(&d); +espacio=ftell(fp); +fwrite(&d,sizeof(d),1,fp1); +fwrite(&espacio,sizeof(long),1,fp1); +fclose(fp1); +fclose(fp); +return pletra; +} +//VISUALIZA AGENDA DE UN DIA EN CONCRETO +void visualizadag(void) +{ +FILE *fp,*fp1; +LET *letra,*pletra,*letrant; +struct date d; +long espacio=0; +long longitud=0; +char pegote[10]; +int dia=0,mes=0,ano=0; +int x=3,y=4,encontrado=0; +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¤o:"); +captura(4,1,pegote,28,3); +ano=matriz1; +letra=(LET *)malloc(sizeof(LET)); +if((fp=fopen("agenda.dat","rb"))==NULL) + {gotoxy(3,3);cprintf(" NO HAY DATOS EN ESTA OPCION ");getch();} +else +{ +fp1=fopen("indiceag.dat","rb"); +while(!feof(fp1)&&encontrado==0) + { + fread(&d,sizeof(d),1,fp1); + if(dia==d.da_day&&mes==d.da_mon&&ano==d.da_year) + { + encontrado=1; + } + longitud=espacio; + fread(&espacio,sizeof(long),1,fp1); + } +if(encontrado==1) +{ +fseek(fp,longitud,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(color1);recuadro(3,3,78,23,0);textattr(color2);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); +} +else + { + gotoxy(4,4); + cprintf("NO SE ENCONTRO ESTA FECHA"); + } +while(!kbhit()) +{ +hora(); +} +} +fflush(stdin); +textattr(color1); +recuadro(2,2,79,24,1); +fclose(fp); +fclose(fp1); +} +//VISUALIZA AGENDA DESDE EL PRINCIPIO +void visualizaag(char nombre[8]) +{ +FILE *fp,*fp1; +LET *letra,*pletra,*letrant; +struct date d; +long pego=0; +long espacio=0; +long longitud=0; +char pegote[10]; +int dia=0,mes=0,ano=0; +int x=3,y=4,encontrado=0; +int salir=0; +recuadro(2,2,79,24,0); +marco(2,2,79,24); +letra=(LET *)malloc(sizeof(LET)); +//if((fp=fopen("agenda.dat","rb"))==NULL) +if((fp=fopen(nombre,"rb"))==NULL) + {gotoxy(3,3);cprintf("[NO HAY DATOS EN LA AGENDA]");getch();} +else +{ +fp1=fopen("indiceag.dat","rb"); +while(salir!=1) +{ +recuadro(3,3,78,23,0); +textattr(color2); +fseek(fp1,pego,SEEK_SET); +fread(&d,sizeof(d),1,fp1); +fread(&espacio,sizeof(espacio),1,fp1); +pego=ftell(fp1); +if(feof(fp1)) salir=1; +else +{ +fseek(fp1,0,SEEK_SET); +dia=d.da_day; +mes=d.da_mon; +ano=d.da_year; +gotoxy(3,3); +cprintf("dia:%d mes:%d a¤o:%d",dia,mes,ano); +x=3;y=4; +espacio=0; +encontrado=0; +while(!feof(fp1)&&encontrado==0) + { + fread(&d,sizeof(d),1,fp1); + if(dia==d.da_day&&mes==d.da_mon&&ano==d.da_year) + { + encontrado=1; + } + longitud=espacio; + fread(&espacio,sizeof(long),1,fp1); + } +if(encontrado==1) +{ +fseek(fp,longitud,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(); + } + while( kbhit() ) getch(); + fflush(stdin); + textattr(color1);recuadro(3,3,78,23,0);textattr(color2);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); +} +else + { + gotoxy(4,4); + cprintf("NO SE ENCONTRO ESTA FECHA"); + } +while(!kbhit()) +{ +hora(); +} +while( kbhit() ) getch(); +} +} +} +fflush(stdin); +textattr(color1); +recuadro(2,2,79,24,1); +fclose(fp); +fclose(fp1); +} +/////////////////////////////////FICHEROS//////////////////////////////////// +void ficheros(char nombre[8]) +{ +visualizaag(nombre); +introduceag(nombre); +} +///////////////////////////////////CAPTURA/////////////////////////////////// +void captura(int tam,int elec,char nombre[80],int x,int y) +{ + int i=0,c=0,c1=0; + matriz1=0; + if(elec==0) + { do + { + gotoxy(x+i,y); + cprintf("þ"); + if (isig!=NULL) + { + strcpy(datos.apellidos,lista->apellidos); + strcpy(datos.nombre,lista->nombre); + strcpy(datos.direccion,lista->direccion); + strcpy(datos.localidad,lista->localidad); + strcpy(datos.provincia,lista->provincia); + strcpy(datos.cod_postal,lista->cod_postal); + strcpy(datos.edad,lista->edad); + strcpy(datos.tfno,lista->tfno); + strcpy(datos.dni,lista->tfno); + strcpy(datos.instrumento,lista->tfno); + fwrite(&datos,sizeof(datos),1,fp); + lista=lista->sig; + } +fclose(fp); +} + + + + + +// -------------------------------- * ------------------------------ +#define ANCHO 80; + +typedef struct PTexto +{ + char *LineaC; +}; + +void RefreshTexto( PTexto *PT, int NLineas, int NLinicio ) +{ + int i, j; + + for ( i = 0; i < NLinicio; i++ ) + PT++; + + for ( i = NLinicio, j = 0; i < NLineas && j < 21; i++, j++ ) + { + gotoxy( 2, j ); + printf( "%s", PT -> LineaC ); + PT++; + } +} + +void PTextos( char *file ) +{ + FILE *PFio; + PTexto *PTxt, *p_aux; + int NumL; + + if ( ( PFio = fopen( file, "rw+" ) ) == NULL ) + { + // No se puede abrir el fichero -ERROR- + return; + } else { + // Seguimos + // No hay memoria -ERROR- + return; + p_aux = PTxt; + NumL = 1; + while ( !eof( PFio ) ) + { + NumL++; + if ( ( PTxt = (PTexto *)calloc( sizeof(PTexto *), NumL ) ) == NULL ) + { + // -ERROR + return; + } + if ( p_aux -> LineaC = (char *)calloc( sizeof( char ), 80 ) ) == NULL ) + { + // -ERROR- + return; + } else { + // Leemos el caracter + fscanf( PFio, "%80s", p_aux -> LineaC ); + } + p_aux ++; + }; + + RefreshTexto( PTxt, NumL, 0 ); + } + +} diff --git a/BANDA.CPP b/BANDA.CPP new file mode 100644 index 0000000..17ec44b --- /dev/null +++ b/BANDA.CPP @@ -0,0 +1,1384 @@ +//BIBLIOTECAS EMPLEADAS +//Bibliotecas +#include +#include +#include +#include +#include +#include +#include +#include +#include +#define color1 7 +#define color2 127 + +//VARIABLES GLOBALES +struct datos{ char apellidos[21]; + char nombre[16]; + char direccion[21]; + char localidad[21]; + char provincia[11]; + char cod_postal[6]; + char edad[3]; + char tfno[10]; + char dni[10]; + char instrumento[11]; + }datos; + +typedef struct nodo{ char apellidos[21]; + char nombre[16]; + char direccion[21]; + char localidad[21]; + char provincia[11]; + char cod_postal[6]; + char edad[3]; + char tfno[10]; + char dni[10]; + char instrumento[11]; + struct nodo *sig; + }PERSONAS; + +struct simbolo{ char letra; + + }simbolo; + +typedef struct nodo1{ char letra; + struct nodo1 *sig; + struct nodo1 *ant; + + }LET; +int matriz1=0; +int opcion=1; +PERSONAS *plista=NULL; +char matriz2[80]; + +//DECLARACION DE FUNCIONES +void graba(); +void diario(int subopcion); +void captura(int tam,int elec,char nombre[80],int x,int y); +void MUSICOS(int subopcion); +void recupera(); +void introducir(); +void borrar(); +void contenido(); +void busca(); +void visualizadag(void); +void visualizaag(char nombre[8]); +LET * introduceag(char nombre[8]); +void hora(void); +void creditos(void); +void dibujaeleccion(); +void dibujasubmenu1(); +void recuadro(int x,int y,int x1,int y1,int o); +void marco(int x,int y,int x1,int y1); +void ayudas(); +void menu(void); + +//FUNCION PRINCIPAL +void main() +{ +int a=0; +recupera(); +clrscr(); +textbackground(0); +_setcursortype(_NOCURSOR); +menu(); +while(opcion!=6||a!=7181) + { + dibujaeleccion(); + while(!kbhit()) + { + hora(); + } + a=bioskey(0); + if(a==7181&&opcion!=6) dibujasubmenu1(); + if(a==19712) opcion++; + if(a==19200) opcion--; + if(opcion==0) opcion=6; + if(opcion==7) opcion=1; + } +graba(); +//system("copy indiceag.dat indiceag.seg"); +//system("copy agenda.dat agenda.seg"); +//system("copy tel.dat tel.seg"); +_setcursortype(_NORMALCURSOR); +textbackground(0); +clrscr(); +} + +//DIBUJA EL INTERFAZ GENERAL +void menu() +{ +clrscr(); +textattr(color1); +recuadro(2,2,79,24,1); +recuadro(2,1,79,1,0); +recuadro(2,25,79,25,0); +} + +//DIBUJA ELECCION +void dibujaeleccion() +{ +//textattr(LIGHTGRAY); +textattr(color2); +gotoxy(5,1); +cprintf("Actuaciones Musicos Organismos Archivos Informacion Salir"); +gotoxy(3,25); +cprintf("Copyrights() o derechos de copia()"); +textattr(color1); +switch(opcion) + { + case 1:gotoxy(5,1);cprintf("Actuaciones");break; + case 2:gotoxy(20,1);cprintf("Musicos");break; + case 3:gotoxy(31,1);cprintf("Organismos");break; + case 4:gotoxy(45,1);cprintf("Archivos");break; + case 5:gotoxy(57,1);cprintf("Informacion");break; + case 6:gotoxy(72,1);cprintf("Salir");break; + } +} + +//DIBUJA SUBMENUS +void dibujasubmenu1() +{ +//subopcion son CURSOS,subopcion1 son CLASES DE CURSOS +//subopcion son eleccion de submenus +int a=0,subopcion1=1,subopcion2=1,subopcion3=1; +int subopcion4=1,subopcion41=1,subopcion42=1,subopcion5=1; +while(a!=7181&&a!=283) +{ +switch(opcion) + { + case 1: //ACTUACIONES + recuadro(5,2,20,7,2); + marco(5,2,19,7); + while(a!=7181&&a!=283&&a!=19712&&a!=19200) + { + textattr(color2); + gotoxy(7,3);cprintf("Toros"); + gotoxy(7,4);cprintf("Procesiones"); + gotoxy(7,5);cprintf("Conciertos"); + gotoxy(7,6);cprintf("Varios"); + textattr(color1); + switch(subopcion1) + { + case 1: gotoxy(7,3);cprintf("Toros");break; + case 2: gotoxy(7,4);cprintf("Procesiones");break; + case 3: gotoxy(7,5);cprintf("Conciertos");break; + case 4: gotoxy(7,6);cprintf("Varios");break; + } + while(!kbhit()) + { + hora(); + } + a=bioskey(0); + if(a==20480) subopcion1++; + if(a==18432) subopcion1--; + if(subopcion1==0) subopcion1=4; + if(subopcion1==5) subopcion1=1; + } + if(a!=283&&a!=19712&&a!=19200) diario(subopcion1); + textattr(color1);recuadro(5,2,21,8,1); + break; + case 2: //MUSICOS + recuadro(20,2,33,7,2); + marco(20,2,33,7); + while(a!=7181&&a!=283&&a!=19712&&a!=19200) + { + textattr(color2); + gotoxy(22,3);cprintf("Introducir"); + gotoxy(22,4);cprintf("Ver lista"); + gotoxy(22,5);cprintf("Borrar"); + gotoxy(22,6);cprintf("Buscar"); + textattr(color1); + switch(subopcion2) + { + case 1: gotoxy(22,3);cprintf("Introducir");break; + case 2: gotoxy(22,4);cprintf("Ver lista");break; + case 3: gotoxy(22,5);cprintf("Borrar");break; + case 4: gotoxy(22,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) + { + MUSICOS(subopcion2); + } + textattr(color1);recuadro(20,2,34,8,1); + break; + case 3: //ORGANISMOS + recuadro(31,2,45,8,2); + marco(31,2,45,8); + while(a!=7181&&a!=283&&a!=19712&&a!=19200) + { + textattr(color2); + gotoxy(33,3);cprintf("Oficiales"); + gotoxy(33,4);cprintf("Hermandades"); + gotoxy(33,5);cprintf("Toros"); + gotoxy(33,6);cprintf("Entidades"); + gotoxy(33,7);cprintf("Varios"); + textattr(color1); + switch(subopcion3) + { + case 1: gotoxy(33,3);cprintf("Oficiales");break; + case 2: gotoxy(33,4);cprintf("Hermandades");break; + case 3: gotoxy(33,5);cprintf("Toros");break; + case 4: gotoxy(33,6);cprintf("Entidades");break; + case 5: gotoxy(33,7);cprintf("Varios");break; + + } + while(!kbhit()) + { + hora(); + } + a=bioskey(0); + if(a==20480) subopcion3++; + if(a==18432) subopcion3--; + if(subopcion3==0) subopcion3=5; + if(subopcion3==6) subopcion3=1; + } + textattr(color1);recuadro(31,2,46,9,1); + break; + case 4://ARCHIVOS + recuadro(45,2,64,7,2); + marco(45,2,64,7); + while(a!=7181&&a!=283&&a!=19712&&a!=19200) + { + textattr(color2); + gotoxy(47,3);cprintf("Marchas"); + gotoxy(47,4);cprintf("Paso dobles"); + gotoxy(47,5);cprintf("Obras/Concientos"); + gotoxy(47,6);cprintf("Varios"); + textattr(color1); + switch(subopcion4) + { + case 1: gotoxy(47,3);cprintf("Marchas");break; + case 2: gotoxy(47,4);cprintf("Paso dobles");break; + case 3: gotoxy(47,5);cprintf("Obras/Conciertos");break; + case 4: gotoxy(47,6);cprintf("Varios");break; + } + while(!kbhit()) + { + hora(); + } + a=bioskey(0); + if(a==20480) subopcion4++; + if(a==18432) subopcion4--; + if(subopcion4==0) subopcion4=4; + if(subopcion4==5) subopcion4=1; + } + if(a!=283&&a!=19712&&a!=19200) + { + a=0; + if (subopcion4==1) + { + recuadro(65,2,77,5,2); + marco(65,2,77,5); + while(a!=7181&&a!=283&&a!=19712&&a!=19200) + { + textattr(color2); + gotoxy(66,3);cprintf("Militares"); + gotoxy(66,4);cprintf("Procesiones"); + textattr(color1); + switch(subopcion41) + { + case 1: gotoxy(66,3);cprintf("Militares");break; + case 2: gotoxy(66,4);cprintf("Procesiones");break; + } + while(!kbhit()) + { + hora(); + } + a=bioskey(0); + if(a==20480) subopcion41++; + if(a==18432) subopcion41--; + if(subopcion41==0) subopcion41=2; + if(subopcion41==3) subopcion41=1; + } + textattr(color1);recuadro(65,2,78,6,1); + dibujasubmenu1(); + } + if (subopcion4==2) + { + recuadro(65,2,76,5,2); + marco(65,2,76,5); + while(a!=7181&&a!=283&&a!=19712&&a!=19200) + { + textattr(color2); + gotoxy(66,3);cprintf("Toros"); + gotoxy(66,4);cprintf("Conciertos"); + textattr(color1); + switch(subopcion42) + { + case 1: gotoxy(66,3);cprintf("Toros");break; + case 2: gotoxy(66,4);cprintf("Conciertos");break; + } + while(!kbhit()) + { + hora(); + } + a=bioskey(0); + if(a==20480) subopcion42++; + if(a==18432) subopcion42--; + if(subopcion42==0) subopcion42=2; + if(subopcion42==3) subopcion42=1; + } + textattr(color1);recuadro(65,2,78,6,1); + dibujasubmenu1(); + } + } + textattr(color1);recuadro(45,2,65,8,1); + break; + case 5: //INFORMACION + recuadro(57,2,68,5,2); + marco(57,2,68,5); + while(a!=7181&&a!=283&&a!=19712&&a!=19200) + { + textattr(color2); + gotoxy(59,3);cprintf("Ayuda"); + gotoxy(59,4);cprintf("Creditos"); + textattr(color1); + switch(subopcion5) + { + case 1: gotoxy(59,3);cprintf("Ayuda");break; + case 2: gotoxy(59,4);cprintf("Creditos");break; + } + while(!kbhit()) + { + hora(); + } + a=bioskey(0); + if(a==20480) subopcion5++; + if(a==18432) subopcion5--; + if(subopcion5==0) subopcion5=2; + if(subopcion5==3) subopcion5=1; + } + if(subopcion5==1&&a!=283&&a==7181) ayudas(); + else if(a!=283&&a==7181/*a!=19712&&a!=19200*/) creditos(); + //if(a!=283&&a!=19712&&a!=19200) + // { + // MUSICOS(subopcion2); + // } + textattr(color1);recuadro(57,2,69,6,1); + break; + + case 6: //SALIR + while(!kbhit()) + { + hora(); + } + a=bioskey(0); + break; + } +if(a==19712) {a=0;opcion++;} +if(a==19200) {a=0;opcion--;} +if(opcion==0) opcion=6; +if(opcion==7) opcion=1; +dibujaeleccion(); +} +} +//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(color1); +for(a=x;a!=x1+1;a++) + for(b=y;b!=y1+1;b++) + { + gotoxy(a,b); + if(o==0||o==2) cprintf("Û"); + else cprintf("²"); + } +if(o==2) + { + textattr(0); + for(a=y+1;asig!=NULL) + { + lista=lista->sig; + } +lista->sig=(PERSONAS *)malloc(sizeof(PERSONAS)); +gotoxy(10,6); +cprintf("Apellidos:"); +gotoxy(41,6); +cprintf("Nombre:"); +gotoxy(10,8); +cprintf("Direccion:"); +gotoxy(10,10); +cprintf("Localidad:"); +gotoxy(41,10); +cprintf("Provincia:"); +gotoxy(10,12); +cprintf("C.P.:"); +gotoxy(36,12); +cprintf("Edad:"); +gotoxy(51,12); +cprintf("Tfno:"); +gotoxy(10,14); +cprintf("DNI:"); +gotoxy(36,14); +cprintf("Instrumento:"); +captura(20,2,lista->apellidos,20,6); +captura(15,2,lista->nombre,48,6); +captura(20,2,lista->direccion,20,8); +captura(20,2,lista->localidad,20,10); +captura(10,2,lista->provincia,51,10); +captura(5,2,lista->cod_postal,16,12); +captura(2,2,lista->edad,41,12); +captura(9,2,lista->tfno,56,12); +captura(9,2,lista->dni,14,14); +captura(10,2,lista->instrumento,48,14); +lista=lista->sig; +lista->sig=NULL; +textattr(color1); +recuadro(9,5,69,20,1); +/*gotoxy(27,11); +cprintf("Nombre:"); +captura(10,1,lista->nombre,34,11); +gotoxy(27,12); +cprintf("Apodo:"); +captura(11,1,lista->apodo,33,12); +gotoxy(27,13); +cprintf("Numero:"); +captura(10,1,lista->numero,34,13);*/ +//textattr(color1); +//recuadro(25,10,53,15,1); +} +/*//METE DATOS +void introducir() +{ +PERSONAS datos; +FILE *fp; +if ((fp=fopen("musico.dat","ab"))==NULL) fp=fopen("musico.dat","wb"); +recuadro(9,5,68,19,2); +marco(9,5,68,19); +gotoxy(10,6); +cprintf("Apellidos:"); +gotoxy(41,6); +cprintf("Nombre:"); +gotoxy(10,8); +cprintf("Direccion:"); +gotoxy(10,10); +cprintf("Localidad:"); +gotoxy(41,10); +cprintf("Provincia:"); +gotoxy(10,12); +cprintf("C.P.:"); +gotoxy(36,12); +cprintf("Edad:"); +gotoxy(51,12); +cprintf("Tfno:"); +gotoxy(10,14); +cprintf("DNI:"); +gotoxy(36,14); +cprintf("Instrumento:"); +captura(20,2,datos.apellidos,20,6); +captura(15,2,datos.nombre,48,6); +captura(20,2,datos.direccion,20,8); +captura(20,2,datos.localidad,20,10); +captura(10,2,datos.provincia,51,10); +captura(5,2,datos.cod_postal,16,12); +captura(2,2,datos.edad,41,12); +captura(9,2,datos.tfno,56,12); +captura(9,2,datos.dni,14,14); +captura(10,2,datos.instrumento,48,14); +textattr(LIGHTGRAY); +recuadro(9,5,69,20,1); +fwrite(&datos,sizeof(datos),1,fp); +fclose(fp); +}*/ +//BORRA DE LA LISTA +void borrar() +{ +int encontrado=0; +char dni[9],nombre[16],apellidos[21]; +PERSONAS *p,*pant; +recuadro(18,10,62,14,2); +marco(18,10,62,14); +gotoxy(21,11); +cprintf("Introduce nombre:"); +captura(15,0,nombre,38,11); +gotoxy(21,12); +cprintf("Introduce apellidos:"); +captura(20,0,apellidos,41,12); +p=plista; +pant=0; +while(strcmp(nombre,p->nombre)!=0&&strcmp(apellidos,p->apellidos)!=0&&(p!=NULL)) + { + pant=p; + p=p->sig; + encontrado=0; + } +if(strcmp(nombre,p->nombre)==0&&strcmp(apellidos,p->apellidos)==0) + { + if(pant==0) {plista=p->sig;free(p);} + pant->sig=p->sig; + free(p); + encontrado=1; + } +if(encontrado==0) {gotoxy(21,13);cprintf("No se encontro");} +else {gotoxy(21,13);cprintf("Nombre borrado");} +while(!kbhit()) +{ +hora(); +} +fflush(stdin); +textattr(color1); +recuadro(18,10,63,15,1); +} +//r para inicio de carro +//MUESTRA EL CONTENIDO +void contenido() +{ +int a,c=0,num=1,y=2; +PERSONAS *lista; +recuadro(2,2,79,24,0); +marco(2,2,79,24); +lista=plista; +while(lista->sig!=NULL) + { + c++; + gotoxy(5,y+1); + cprintf("%d.-%s %s DNI:%s",num,lista->nombre,lista->apellidos,lista->dni); + gotoxy(8,y+2); + cprintf("%s",lista->direccion); + gotoxy(8,y+3); + cprintf("%5s %20s %10s tfno:%9s\n",lista->cod_postal,lista->localidad,lista->provincia,lista->tfno); + y=y+3; + if(c==7) + { + y=2;c=0;gotoxy(37,24);cprintf("[PULSE TECLA]"); + while(!kbhit()) + { + hora(); + } + while( kbhit() ) getch(); + textattr(color1); + recuadro(3,3,78,23,0);textattr(color2);} + lista=lista->sig; + num++; + } +if(c==0) + { + marco(23,10,60,14); + gotoxy(29,12); + cprintf("NO SE ENCONTRARON TELEFONOS"); + } +while(!kbhit()) +{ +hora(); +} +fflush(stdin); +textattr(color1); +recuadro(2,2,79,24,1); +} +/*//MUESTRA EL CONTENIDO +void contenido() +{ +int a,c=2,paso=0,num=1; +//INFO *lista; +PERSONAS datos; +FILE *fp; +fp=fopen("musico.dat","rb"); +recuadro(2,2,79,24,0); +marco(2,2,79,24); +//lista=plista; +while(!feof(fp)) + { + if (paso==1) + { + gotoxy(5,c+1); + cprintf("%d.-%s %s DNI:%s",num,datos.nombre,datos.apellidos,datos.dni); + gotoxy(8,c+2); + cprintf("%s",datos.direccion); + gotoxy(8,c+3); + cprintf("%5s %20s %10s tfno:%9s\n",datos.cod_postal,datos.localidad,datos.provincia,datos.tfno); +// lista=lista->sig; + c=c+4; + num++; + if(c==22) + { + c=2;gotoxy(37,24);cprintf("[PULSE TECLA]"); + while(!kbhit()) + { + hora(); + } + while( kbhit() ) getch(); + textattr(LIGHTGRAY); + recuadro(3,3,78,23,0);textattr(color2); + } + } + fread(&datos,sizeof(datos),1,fp); + paso=1; + } +if(c==0) + { + marco(23,10,60,14); + gotoxy(29,12); + cprintf("NO SE ENCONTRARON MUSICOS"); + } +while(!kbhit()) + { + hora(); + } +fflush(stdin); +textattr(LIGHTGRAY); +recuadro(2,2,79,24,1); +fclose(fp); +} */ +//BUSCA EL NOMBRE DE UNA PERSONA +void busca() +{ +char nombre[16],apellidos[21]; +int a,b=0,c=0; +PERSONAS *lista; +lista=plista; +recuadro(2,2,79,24,0); +marco(2,2,79,24); +gotoxy(4,3); +cprintf("Nombre:"); +captura(15,0,nombre,11,3); +gotoxy(4,4); +cprintf("Apellidos:"); +captura(20,0,apellidos,14,4); +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(nombre,lista->nombre)==0&&strcmp(apellidos,lista->apellidos)==0) + { + recuadro(9,5,68,19,2); + marco(9,5,68,19); + gotoxy(10,6); + cprintf("Apellidos:%s",datos.apellidos); + gotoxy(41,6); + cprintf("Nombre:%s",datos.nombre); + gotoxy(10,8); + cprintf("Direccion:%s",datos.direccion); + gotoxy(10,10); + cprintf("Localidad:%s",datos.localidad); + gotoxy(41,10); + cprintf("Provincia:%s",datos.provincia); + gotoxy(10,12); + cprintf("C.P.:%s",datos.cod_postal); + gotoxy(36,12); + cprintf("Edad:%s",datos.edad); + gotoxy(51,12); + cprintf("Tfno:%s",datos.tfno); + gotoxy(10,14); + cprintf("DNI:%s",datos.dni); + gotoxy(36,14); + cprintf("Instrumento:%s",datos.instrumento); + b=1; + c++; + } +lista=lista->sig; +} +if(b==0) {gotoxy(4,5);cprintf("Nombre no encontrado");} +while(!kbhit()) +{ +hora(); +} +fflush(stdin); +textattr(color1); +recuadro(2,2,79,24,1); +} +/*//BUSCA EL NOMBRE DE UNA PERSONA +void busca() +{ +char apellidos[20],nombre[15]; +int encontrado=0; +PERSONAS datos; +FILE *fp; +fp=fopen("musico.dat","rb"); +recuadro(2,2,79,24,0); +marco(2,2,79,24); +gotoxy(4,3); +cprintf("Nombre:"); +captura(15,0,nombre,20,3); +gotoxy(4,4); +cprintf("Apellidos:"); +captura(20,0,apellidos,20,4); +while(!feof(fp)&&encontrado==0) +{ +//while(!kbhit()) +// { +// hora(); +// } +fread (&datos,sizeof(datos),1,fp); +if(strcmp(nombre,datos.nombre)==0&&strcmp(apellidos,datos.apellidos)==0) + { + encontrado=1; + recuadro(9,5,68,19,2); + marco(9,5,68,19); + gotoxy(10,6); + cprintf("Apellidos:%s",datos.apellidos); + gotoxy(41,6); + cprintf("Nombre:%s",datos.nombre); + gotoxy(10,8); + cprintf("Direccion:%s",datos.direccion); + gotoxy(10,10); + cprintf("Localidad:%s",datos.localidad); + gotoxy(41,10); + cprintf("Provincia:%s",datos.provincia); + gotoxy(10,12); + cprintf("C.P.:%s",datos.cod_postal); + gotoxy(36,12); + cprintf("Edad:%s",datos.edad); + gotoxy(51,12); + cprintf("Tfno:%s",datos.tfno); + gotoxy(10,14); + cprintf("DNI:%s",datos.dni); + gotoxy(36,14); + cprintf("Instrumento:%s",datos.instrumento); + } +} +if(encontrado==0) {gotoxy(4,5);cprintf("Nombre no encontrado");} +while(!kbhit()) +{ +hora(); +} +fflush(stdin); +textattr(7); +recuadro(2,2,79,24,1); +fclose(fp); +} */ +//RECUPERA +void recupera() +{ +FILE *fp; +PERSONAS *lista; +if((fp=fopen("musico.dat","rb"))==NULL) fp=fopen("musico.dat","wb"); +else + { + fread(&datos,sizeof(datos),1,fp); + lista=(PERSONAS *)malloc(sizeof(PERSONAS)); + plista=lista; + strcpy(lista->apellidos,datos.apellidos); + strcpy(lista->nombre,datos.nombre); + strcpy(lista->direccion,datos.direccion); + strcpy(lista->localidad,datos.localidad); + strcpy(lista->provincia,datos.provincia); + strcpy(lista->cod_postal,datos.cod_postal); + strcpy(lista->edad,datos.edad); + strcpy(lista->tfno,datos.tfno); + strcpy(lista->dni,datos.dni); + strcpy(lista->instrumento,datos.instrumento); + while(!feof(fp)) + { + fread(&datos,sizeof(datos),1,fp); + lista->sig=(PERSONAS *)malloc(sizeof(PERSONAS)); + lista=lista->sig; + strcpy(lista->apellidos,datos.apellidos); + strcpy(lista->nombre,datos.nombre); + strcpy(lista->direccion,datos.direccion); + strcpy(lista->localidad,datos.localidad); + strcpy(lista->provincia,datos.provincia); + strcpy(lista->cod_postal,datos.cod_postal); + strcpy(lista->edad,datos.edad); + strcpy(lista->tfno,datos.tfno); + strcpy(lista->dni,datos.dni); + strcpy(lista->instrumento,datos.instrumento); + } + } +lista->sig=NULL; +fclose(fp); +} +/////////////////////////////////DIARIO////////////////////////////////////// +void diario(int subopcion) +{ +//char clave[20]; +//recuadro(30,10,53,14,0); +//marco(30,10,53,14); +//gotoxy(31,12); +//cprintf("CLAVE:"); +//captura(16,0,clave,37,12); +//if (strcmp(clave,"PROHIBIDOX")==0) + switch(subopcion) + { + case 1:visualizaag("toros");introduceag("toros");break; + case 2:visualizaag("proce");introduceag("proce");break; + case 3:visualizaag("conci");introduceag("conci");break; + case 4:visualizaag("vario");introduceag("vario");break; +// case 2:visualizadag();break; +// case 3:visualizaag("toros");break; + } +/*else + { + gotoxy(31,13); + cprintf("CLAVE INCORRECTA"); + getch(); + }*/ +recuadro(30,10,53,14,1); +} +//INTRODUCE AGENDA +LET * introduceag(char nombre[8]) +{ +FILE *fp,*fp1; +LET *letra,*letrant,*pletra; +long espacio; +struct date d; +int x=3,y=3; +char a='0'; +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=78;y=y-1;} + if(y==20) + { + gotoxy(37,24);cprintf("[PULSE UNA TECLA]"); + while(!kbhit()) + { + hora(); + } + textattr(color1);recuadro(3,3,78,23,0);textattr(color2);x=3;y=3; + } + gotoxy(x,y); + cprintf("±"); + 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,y);cprintf(" "); + 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(color1); +recuadro(2,2,79,24,1); +fp1=fopen("indiceag.dat","a+b"); +//fp=fopen("agenda.dat","a+b"); +fp=fopen(nombre,"a+b"); +letra=pletra; +while(letra->sig!=NULL) + { + simbolo.letra=letra->letra; + fwrite(&simbolo.letra,sizeof(simbolo),1,fp); + letra=letra->sig; + } +getdate(&d); +espacio=ftell(fp); +fwrite(&d,sizeof(d),1,fp1); +fwrite(&espacio,sizeof(long),1,fp1); +fclose(fp1); +fclose(fp); +return pletra; +} +//VISUALIZA AGENDA DE UN DIA EN CONCRETO +void visualizadag(void) +{ +FILE *fp,*fp1; +LET *letra,*pletra,*letrant; +struct date d; +long espacio=0; +long longitud=0; +char pegote[10]; +int dia=0,mes=0,ano=0; +int x=3,y=4,encontrado=0; +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¤o:"); +captura(4,1,pegote,28,3); +ano=matriz1; +letra=(LET *)malloc(sizeof(LET)); +if((fp=fopen("agenda.dat","rb"))==NULL) + {gotoxy(3,3);cprintf(" NO HAY DATOS EN ESTA OPCION ");getch();} +else +{ +fp1=fopen("indiceag.dat","rb"); +while(!feof(fp1)&&encontrado==0) + { + fread(&d,sizeof(d),1,fp1); + if(dia==d.da_day&&mes==d.da_mon&&ano==d.da_year) + { + encontrado=1; + } + longitud=espacio; + fread(&espacio,sizeof(long),1,fp1); + } +if(encontrado==1) +{ +fseek(fp,longitud,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(color1);recuadro(3,3,78,23,0);textattr(color2);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); +} +else + { + gotoxy(4,4); + cprintf("NO SE ENCONTRO ESTA FECHA"); + } +while(!kbhit()) +{ +hora(); +} +} +fflush(stdin); +textattr(color1); +recuadro(2,2,79,24,1); +fclose(fp); +fclose(fp1); +} +//VISUALIZA AGENDA DESDE EL PRINCIPIO +void visualizaag(char nombre[8]) +{ +FILE *fp,*fp1; +LET *letra,*pletra,*letrant; +struct date d; +long pego=0; +long espacio=0; +long longitud=0; +char pegote[10]; +int dia=0,mes=0,ano=0; +int x=3,y=4,encontrado=0; +int salir=0; +recuadro(2,2,79,24,0); +marco(2,2,79,24); +letra=(LET *)malloc(sizeof(LET)); +//if((fp=fopen("agenda.dat","rb"))==NULL) +if((fp=fopen(nombre,"rb"))==NULL) + {gotoxy(3,3);cprintf("[NO HAY DATOS EN LA AGENDA]");getch();} +else +{ +fp1=fopen("indiceag.dat","rb"); +while(salir!=1) +{ +recuadro(3,3,78,23,0); +textattr(color2); +fseek(fp1,pego,SEEK_SET); +fread(&d,sizeof(d),1,fp1); +fread(&espacio,sizeof(espacio),1,fp1); +pego=ftell(fp1); +if(feof(fp1)) salir=1; +else +{ +fseek(fp1,0,SEEK_SET); +dia=d.da_day; +mes=d.da_mon; +ano=d.da_year; +gotoxy(3,3); +cprintf("dia:%d mes:%d a¤o:%d",dia,mes,ano); +x=3;y=4; +espacio=0; +encontrado=0; +while(!feof(fp1)&&encontrado==0) + { + fread(&d,sizeof(d),1,fp1); + if(dia==d.da_day&&mes==d.da_mon&&ano==d.da_year) + { + encontrado=1; + } + longitud=espacio; + fread(&espacio,sizeof(long),1,fp1); + } +if(encontrado==1) +{ +fseek(fp,longitud,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(); + } + while( kbhit() ) getch(); + fflush(stdin); + textattr(color1);recuadro(3,3,78,23,0);textattr(color2);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); +} +else + { + gotoxy(4,4); + cprintf("NO SE ENCONTRO ESTA FECHA"); + } +while(!kbhit()) +{ +hora(); +} +while( kbhit() ) getch(); +} +} +} +fflush(stdin); +textattr(color1); +recuadro(2,2,79,24,1); +fclose(fp); +fclose(fp1); +} +/////////////////////////////////FICHEROS//////////////////////////////////// +void ficheros(char nombre[8]) +{ +visualizaag(nombre); +introduceag(nombre); +} +///////////////////////////////////CAPTURA/////////////////////////////////// +void captura(int tam,int elec,char nombre[80],int x,int y) +{ + int i=0,c=0,c1=0; + matriz1=0; + if(elec==0) + { do + { + gotoxy(x+i,y); + cprintf("þ"); + if (isig!=NULL) + { + strcpy(datos.apellidos,lista->apellidos); + strcpy(datos.nombre,lista->nombre); + strcpy(datos.direccion,lista->direccion); + strcpy(datos.localidad,lista->localidad); + strcpy(datos.provincia,lista->provincia); + strcpy(datos.cod_postal,lista->cod_postal); + strcpy(datos.edad,lista->edad); + strcpy(datos.tfno,lista->tfno); + strcpy(datos.dni,lista->tfno); + strcpy(datos.instrumento,lista->tfno); + fwrite(&datos,sizeof(datos),1,fp); + lista=lista->sig; + } +fclose(fp); +} + + + + + diff --git a/BANDA.EXE b/BANDA.EXE new file mode 100644 index 0000000..85c43ed Binary files /dev/null and b/BANDA.EXE differ diff --git a/BANDA.OBJ b/BANDA.OBJ new file mode 100644 index 0000000..5a38f54 Binary files /dev/null and b/BANDA.OBJ differ diff --git a/BCN1A.DAT b/BCN1A.DAT new file mode 100644 index 0000000..ec26d9d Binary files /dev/null and b/BCN1A.DAT differ diff --git a/BCN1B.DAT b/BCN1B.DAT new file mode 100644 index 0000000..e69de29 diff --git a/BCN2A.DAT b/BCN2A.DAT new file mode 100644 index 0000000..e69de29 diff --git a/BCN2B.DAT b/BCN2B.DAT new file mode 100644 index 0000000..e69de29 diff --git a/Builder/agenda/Agenda.cpp b/Builder/agenda/Agenda.cpp new file mode 100644 index 0000000..29302d7 --- /dev/null +++ b/Builder/agenda/Agenda.cpp @@ -0,0 +1,131 @@ +//--------------------------------------------------------------------------- +#include +#pragma hdrstop + +#include "Agenda.h" +#include "bdiario.h" +#include "diario.h" +#include "dos.h" +#include "listado.h" +#include "recuerda.h" +#include "telefonos.h" +//--------------------------------------------------------------------------- +#pragma link "Grids" +#pragma resource "*.dfm" +int dia; +AnsiString fecha; +TForm1 *Form1; +//--------------------------------------------------------------------------- +__fastcall TForm1::TForm1(TComponent* Owner) + : TForm(Owner) +{ +} +//--------------------------------------------------------------------------- +void __fastcall TForm1::Salir1Click(TObject *Sender) +{ + Close(); +} +//--------------------------------------------------------------------------- +void __fastcall TForm1::Introducir2Click(TObject *Sender) +{ + TForm2 *Telefonos; + Telefonos = new TForm2(this); + Telefonos->ShowModal(); + delete Telefonos; +} +//--------------------------------------------------------------------------- +void __fastcall TForm1::Creditos2Click(TObject *Sender) +{ + ShowMessage("Programa Realizado por OGA"); +} +//--------------------------------------------------------------------------- +void __fastcall TForm1::ListaClick(TObject *Sender) +{ + TForm5 *Listado; + Listado = new TForm5(this); + Listado->ShowModal(); + delete Listado; +} +//--------------------------------------------------------------------------- +void __fastcall TForm1::Introducir3Click(TObject *Sender) +{ + TForm3 *Recordatorio; + Recordatorio = new TForm3(this); + Recordatorio->ShowModal(); + delete Recordatorio; +} +//--------------------------------------------------------------------------- +void __fastcall TForm1::Vertodos1Click(TObject *Sender) +{ + Table1->Refresh(); + Panel1->Visible=true; + DBGrid1->Visible=true; +} +//--------------------------------------------------------------------------- +void __fastcall TForm1::FormActivate(TObject *Sender) +{ + TLocateOptions relacion; + relacion << loPartialKey; + int dia; + int mes; + int ano; + struct date d; + getdate(&d); + dia = d.da_day; + mes = d.da_mon; + ano = d.da_year; + fecha = AnsiString(dia) + '/' + AnsiString(mes) + '/' + AnsiString(ano); + if (Table1->Locate("Fecha", fecha ,relacion) == true) + { + Label1->Visible=true; + Panel1->Visible=true; + Panel1->Caption=Table1->FieldValues["Recordatorio"]; + } +} +//--------------------------------------------------------------------------- +void __fastcall TForm1::DBGrid1KeyPress(TObject *Sender, char &Key) +{ + DBGrid1->Visible=false; +} +//--------------------------------------------------------------------------- +void __fastcall TForm1::Button1Click(TObject *Sender) +{ + Panel1->Visible=false; + DBGrid1->Visible=false; +} +//--------------------------------------------------------------------------- +void __fastcall TForm1::Introducir1Click(TObject *Sender) +{ + TForm6 *Diario; + Diario = new TForm6(this); + Diario->ShowModal(); + delete Diario; +} +//--------------------------------------------------------------------------- +void __fastcall TForm1::PorFecha1Click(TObject *Sender) +{ + TForm7 *BDiario; + BDiario = new TForm7(this); + BDiario->Label1->Caption = "Introduzca Fecha:"; + BDiario->Edit1->Visible=true; + BDiario->DBEdit1->Visible=false; + BDiario->DBMemo1->Clear(); + dia=1; + BDiario->ShowModal(); + delete BDiario; +} +//--------------------------------------------------------------------------- +void __fastcall TForm1::TodaAgenda1Click(TObject *Sender) +{ + TForm7 *BDiario; + BDiario = new TForm7(this); + BDiario->Label1->Caption = "Fecha"; + BDiario->Edit1->Visible=false; + BDiario->DBEdit1->Visible=true; + dia=2; + BDiario->ShowModal(); + delete BDiario; +} +//--------------------------------------------------------------------------- + + diff --git a/Builder/agenda/Agenda.dfm b/Builder/agenda/Agenda.dfm new file mode 100644 index 0000000..5bda60d Binary files /dev/null and b/Builder/agenda/Agenda.dfm differ diff --git a/Builder/agenda/Agenda.h b/Builder/agenda/Agenda.h new file mode 100644 index 0000000..b14777e --- /dev/null +++ b/Builder/agenda/Agenda.h @@ -0,0 +1,66 @@ +//--------------------------------------------------------------------------- +#ifndef AgendaH +#define AgendaH +//--------------------------------------------------------------------------- +#include +#include +#include +#include +#include +#include +#include +#include "Grids.hpp" +#include +#include +#include +//--------------------------------------------------------------------------- +class TForm1 : public TForm +{ +__published: // IDE-managed Components + TMainMenu *MainMenu1; + TMenuItem *Diario1; + TMenuItem *Telfonos1; + TMenuItem *Recordatorios1; + TMenuItem *Archivo1; + TMenuItem *Introducir1; + TMenuItem *Visualizar1; + TMenuItem *Introducir2; + TMenuItem *Lista; + TMenuItem *PorFecha1; + TMenuItem *TodaAgenda1; + TMenuItem *Salir1; + TMenuItem *Creditos2; + TMenuItem *Introducir3; + TMenuItem *Vertodos1; + TPanel *Panel1; + TLabel *Label1; + TDBGrid *DBGrid1; + TButton *Button1; + TDataSource *DataSource1; + TTable *Table1; + void __fastcall Salir1Click(TObject *Sender); + void __fastcall Introducir2Click(TObject *Sender); + void __fastcall Creditos2Click(TObject *Sender); + + + + void __fastcall ListaClick(TObject *Sender); + void __fastcall Introducir3Click(TObject *Sender); + void __fastcall Vertodos1Click(TObject *Sender); + void __fastcall FormActivate(TObject *Sender); + void __fastcall DBGrid1KeyPress(TObject *Sender, char &Key); + void __fastcall Button1Click(TObject *Sender); + void __fastcall Introducir1Click(TObject *Sender); + + void __fastcall PorFecha1Click(TObject *Sender); + void __fastcall TodaAgenda1Click(TObject *Sender); +private: // User declarations +public: // User declarations + __fastcall TForm1(TComponent* Owner); +}; +//--------------------------------------------------------------------------- +extern int dia; +extern AnsiString fecha; +extern TForm1 *Form1; +//--------------------------------------------------------------------------- +#endif diff --git a/Builder/agenda/Agendas.cpp b/Builder/agenda/Agendas.cpp new file mode 100644 index 0000000..92dbcaa --- /dev/null +++ b/Builder/agenda/Agendas.cpp @@ -0,0 +1,28 @@ +//--------------------------------------------------------------------------- +#include +#pragma hdrstop +//--------------------------------------------------------------------------- +USEFORM("Agenda.cpp", Form1); +USERES("Agendas.res"); +USEFORM("Recuerda.cpp", Form3); +USEFORM("busqueda.cpp", Form4); +USEFORM("telefonos.cpp", Form2); +USEFORM("listado.cpp", Form5); +USEFORM("diario.cpp", Form6); +USEFORM("bdiario.cpp", Form7); +//--------------------------------------------------------------------------- +WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int) +{ + try + { + Application->Initialize(); + Application->CreateForm(__classid(TForm1), &Form1); + Application->Run(); + } + catch (Exception &exception) + { + Application->ShowException(&exception); + } + return 0; +} +//--------------------------------------------------------------------------- diff --git a/Builder/agenda/Agendas.dsk b/Builder/agenda/Agendas.dsk new file mode 100644 index 0000000..8b19ec1 --- /dev/null +++ b/Builder/agenda/Agendas.dsk @@ -0,0 +1,144 @@ +[MainWindow] +Create=1 +Visible=1 +State=0 +Left=0 +Top=0 +Width=1027 +Height=111 +MaxLeft=-1 +MaxTop=-1 +ClientWidth=1019 +ClientHeight=60 + +[PropertyInspector] +Create=1 +Visible=1 +State=0 +Left=0 +Top=113 +Width=414 +Height=502 +MaxLeft=-1 +MaxTop=-1 +ClientWidth=406 +ClientHeight=473 +SplitPos=199 + +[ProjectManager] +LargeButtons=1 + +[Closed Files] +File_0=SourceModule,'L:\Programación (-CBuilder-)\TpvWin\WebWizard\WebWizard.cpp',0,1,169,3,181,0,1 +File_1=SourceModule,'L:\Programación (-CBuilder-)\TAlarcon\TAlarconFichas.cpp',0,1,1,1,1,0,0 +File_2=SourceModule,'L:\Programación (-CBuilder-)\TAlarcon\TAlarcon.cpp',0,1,235,1,247,0,0 +File_3=SourceModule,'L:\Programación (-CBuilder-)\TAlarcon\TAlarconRegLlamadasSIMPLE.cpp',0,1,1,1,1,0,0 +File_4=SourceModule,'L:\Programación (-CBuilder-)\TAlarcon\TAlarconRegLlamadas.cpp',0,1,1,1,1,0,0 +File_5=SourceModule,'L:\Programación (-CBuilder-)\TAlarcon\LSPrecios2.cpp',0,1,1,12,2,0,0 + +[Modules] +Module0=C:\program\SRC_DOS\VARIOS\OSCAR\Builder\agenda\telefonos.cpp +Module1=C:\program\SRC_DOS\VARIOS\OSCAR\Builder\agenda\diario.cpp +Module2=J:\CBuilder3\Projects\ProjectGroup1.bpg +Module3=C:\program\SRC_DOS\VARIOS\OSCAR\Builder\agenda\Agendas.mak +Module4=C:\program\SRC_DOS\VARIOS\OSCAR\Builder\agenda\Agenda.cpp +Module5=C:\program\SRC_DOS\VARIOS\OSCAR\Builder\agenda\Recuerda.cpp +Count=6 +EditWindowCount=1 + +[C:\program\SRC_DOS\VARIOS\OSCAR\Builder\agenda\telefonos.cpp] +ModuleType=SourceModule +FormState=1 +FormOnTop=1 + +[C:\program\SRC_DOS\VARIOS\OSCAR\Builder\agenda\diario.cpp] +ModuleType=SourceModule +FormState=1 +FormOnTop=0 + +[J:\CBuilder3\Projects\ProjectGroup1.bpg] +ModuleType=SourceModule +FormState=0 +FormOnTop=0 + +[C:\program\SRC_DOS\VARIOS\OSCAR\Builder\agenda\Agendas.mak] +ModuleType=SourceModule +FormState=0 +FormOnTop=0 + +[C:\program\SRC_DOS\VARIOS\OSCAR\Builder\agenda\Agenda.cpp] +ModuleType=SourceModule +FormState=3 +FormOnTop=0 + +[C:\program\SRC_DOS\VARIOS\OSCAR\Builder\agenda\Recuerda.cpp] +ModuleType=SourceModule +FormState=0 +FormOnTop=0 + +[EditWindow0] +Create=1 +Visible=1 +State=0 +Left=317 +Top=258 +Width=640 +Height=376 +MaxLeft=-1 +MaxTop=-1 +ClientWidth=632 +ClientHeight=347 +SplitPos=50 +MessagePane=0 +ViewCount=5 +CurrentView=1 +View0=0 +View1=1 +View2=2 +View3=3 +View4=4 + +[View0] +Module=C:\program\SRC_DOS\VARIOS\OSCAR\Builder\agenda\Agenda.cpp +CursorX=22 +CursorY=106 +TopLine=92 +LeftCol=1 + +[View1] +Module=C:\program\SRC_DOS\VARIOS\OSCAR\Builder\agenda\diario.cpp +CursorX=52 +CursorY=62 +TopLine=56 +LeftCol=1 + +[View2] +Module=C:\program\SRC_DOS\VARIOS\OSCAR\Builder\agenda\Agendas.cpp +CursorX=69 +CursorY=4 +TopLine=1 +LeftCol=1 + +[View3] +Module=C:\program\SRC_DOS\VARIOS\OSCAR\Builder\agenda\telefonos.cpp +CursorX=1 +CursorY=18 +TopLine=15 +LeftCol=1 + +[View4] +Module=C:\program\SRC_DOS\VARIOS\OSCAR\Builder\agenda\diario.h +CursorX=1 +CursorY=1 +TopLine=1 +LeftCol=1 + +[Breakpoints] +Count=0 + +[AddressBreakpoints] +Count=0 + +[Watches] +Count=0 + diff --git a/Builder/agenda/Agendas.exe b/Builder/agenda/Agendas.exe new file mode 100644 index 0000000..91b80d1 Binary files /dev/null and b/Builder/agenda/Agendas.exe differ diff --git a/Builder/agenda/Agendas.mak b/Builder/agenda/Agendas.mak new file mode 100644 index 0000000..7530c72 --- /dev/null +++ b/Builder/agenda/Agendas.mak @@ -0,0 +1,94 @@ +# --------------------------------------------------------------------------- +VERSION = BCB.03 +# --------------------------------------------------------------------------- +!ifndef BCB +BCB = $(MAKEDIR)\.. +!endif +# --------------------------------------------------------------------------- +PROJECT = Agendas.exe +OBJFILES = Agendas.obj Agenda.obj Recuerda.obj busqueda.obj telefonos.obj \ + listado.obj diario.obj bdiario.obj +RESFILES = Agendas.res +RESDEPEN = $(RESFILES) Agenda.dfm Recuerda.dfm busqueda.dfm telefonos.dfm \ + listado.dfm diario.dfm bdiario.dfm +LIBFILES = +LIBRARIES = vcldbx35.lib vcldb35.lib vclx35.lib vcl35.lib +SPARELIBS = vcl35.lib vclx35.lib vcldb35.lib vcldbx35.lib +PACKAGES = +PATHASM = .; +PATHCPP = .; +PATHPAS = .; +PATHRC = .; +DEBUGLIBPATH = $(BCB)\lib\debug +RELEASELIBPATH = $(BCB)\lib\release +DEFFILE = +# --------------------------------------------------------------------------- +CFLAG1 = -Od -Hc -w -Ve -r- -k -y -v -vi- -c -b- -w-par -w-inl -Vx +CFLAG2 = -I$(BCB)\projects;$(BCB)\include;$(BCB)\include\vcl -H=$(BCB)\lib\vcld.csm +CFLAG3 = +PFLAGS = -AWinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE \ + -U$(BCB)\projects;$(BCB)\lib\obj;$(BCB)\lib;$(DEBUGLIBPATH) \ + -I$(BCB)\projects;$(BCB)\include;$(BCB)\include\vcl -$Y -$W -$O- -v -JPHNV -M +RFLAGS = -i$(BCB)\projects;$(BCB)\include;$(BCB)\include\vcl +AFLAGS = /i$(BCB)\projects /i$(BCB)\include /i$(BCB)\include\vcl /mx /w2 /zd +LFLAGS = -L$(BCB)\projects;$(BCB)\lib\obj;$(BCB)\lib;$(DEBUGLIBPATH) -aa -Tpe -x -v +IFLAGS = +LINKER = ilink32 +# --------------------------------------------------------------------------- +ALLOBJ = c0w32.obj sysinit.obj $(OBJFILES) +ALLRES = $(RESFILES) +ALLLIB = $(LIBFILES) $(LIBRARIES) import32.lib cp32mt.lib +# --------------------------------------------------------------------------- +.autodepend + +!ifdef IDEOPTIONS + +[Version Info] +IncludeVerInfo=0 +AutoIncBuild=0 +MajorVer=1 +MinorVer=0 +Release=0 +Build=0 +Debug=0 +PreRelease=0 +Special=0 +Private=0 +DLL=0 +Locale=3082 +CodePage=1252 + +[Debugging] +DebugSourceDirs= + +[Parameters] +RunParams= +HostApplication= + +!endif + +$(PROJECT): $(OBJFILES) $(RESDEPEN) $(DEFFILE) + $(BCB)\BIN\$(LINKER) @&&! + $(LFLAGS) + + $(ALLOBJ), + + $(PROJECT),, + + $(ALLLIB), + + $(DEFFILE), + + $(ALLRES) +! + +.pas.hpp: + $(BCB)\BIN\dcc32 $(PFLAGS) { $** } + +.pas.obj: + $(BCB)\BIN\dcc32 $(PFLAGS) { $** } + +.cpp.obj: + $(BCB)\BIN\bcc32 $(CFLAG1) $(CFLAG2) -o$* $* + +.c.obj: + $(BCB)\BIN\bcc32 $(CFLAG1) $(CFLAG2) -o$* $** + +.rc.res: + $(BCB)\BIN\brcc32 $(RFLAGS) $< +#----------------------------------------------------------------------------- diff --git a/Builder/agenda/Agendas.res b/Builder/agenda/Agendas.res new file mode 100644 index 0000000..d62b739 Binary files /dev/null and b/Builder/agenda/Agendas.res differ diff --git a/Builder/agenda/RS.mak b/Builder/agenda/RS.mak new file mode 100644 index 0000000..d54615c --- /dev/null +++ b/Builder/agenda/RS.mak @@ -0,0 +1,55 @@ +# --------------------------------------------------------------------------- +VERSION = BCB.01 +# --------------------------------------------------------------------------- +!ifndef BCB +BCB = $(MAKEDIR)\.. +!endif +# --------------------------------------------------------------------------- +PROJECT = RS.exe +OBJFILES = RS.obj R.obj +RESFILES = RS.res +RESDEPEN = $(RESFILES) R.dfm +LIBFILES = +DEFFILE = +# --------------------------------------------------------------------------- +CFLAG1 = -Od -Hc -w -k -r- -y -v -vi- -c -a4 -b- -w-par -w-inl -Vx -Ve -x +CFLAG2 = -I$(BCB)\include;$(BCB)\include\vcl -H=$(BCB)\lib\vcld.csm +PFLAGS = -U$(BCB)\lib\obj;$(BCB)\lib -I$(BCB)\include;$(BCB)\include\vcl \ + -AWinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE -v \ + -$Y -$W -$O- -JPHNV -M +RFLAGS = -i$(BCB)\include;$(BCB)\include\vcl +LFLAGS = -L$(BCB)\lib\obj;$(BCB)\lib -aa -Tpe -x -v -V4.0 +IFLAGS = +LINKER = ilink32 +# --------------------------------------------------------------------------- +ALLOBJ = c0w32.obj $(OBJFILES) +ALLRES = $(RESFILES) +ALLLIB = $(LIBFILES) vcl.lib import32.lib cp32mt.lib +# --------------------------------------------------------------------------- +.autodepend + +$(PROJECT): $(OBJFILES) $(RESDEPEN) $(DEFFILE) + $(BCB)\BIN\$(LINKER) @&&! + $(LFLAGS) + + $(ALLOBJ), + + $(PROJECT),, + + $(ALLLIB), + + $(DEFFILE), + + $(ALLRES) +! + +.pas.hpp: + $(BCB)\BIN\dcc32 $(PFLAGS) { $** } + +.pas.obj: + $(BCB)\BIN\dcc32 $(PFLAGS) { $** } + +.cpp.obj: + $(BCB)\BIN\bcc32 $(CFLAG1) $(CFLAG2) -o$* $* + +.c.obj: + $(BCB)\BIN\bcc32 $(CFLAG1) $(CFLAG2) -o$* $** + +.rc.res: + $(BCB)\BIN\brcc32 $(RFLAGS) $< +#----------------------------------------------------------------------------- diff --git a/Builder/agenda/Recordatorio.PX b/Builder/agenda/Recordatorio.PX new file mode 100644 index 0000000..3190f3a Binary files /dev/null and b/Builder/agenda/Recordatorio.PX differ diff --git a/Builder/agenda/Recordatorio.VAL b/Builder/agenda/Recordatorio.VAL new file mode 100644 index 0000000..103db8a Binary files /dev/null and b/Builder/agenda/Recordatorio.VAL differ diff --git a/Builder/agenda/Recordatorio.db b/Builder/agenda/Recordatorio.db new file mode 100644 index 0000000..d4e5ee4 Binary files /dev/null and b/Builder/agenda/Recordatorio.db differ diff --git a/Builder/agenda/Recuerda.cpp b/Builder/agenda/Recuerda.cpp new file mode 100644 index 0000000..9df8cce --- /dev/null +++ b/Builder/agenda/Recuerda.cpp @@ -0,0 +1,85 @@ +//--------------------------------------------------------------------------- +#include +#pragma hdrstop + +#include "busqueda.h" +#include "Recuerda.h" +//--------------------------------------------------------------------------- +#pragma resource "*.dfm" +TForm3 *Form3; +//--------------------------------------------------------------------------- +__fastcall TForm3::TForm3(TComponent* Owner) + : TForm(Owner) +{ +} +//--------------------------------------------------------------------------- +void __fastcall TForm3::Button1Click(TObject *Sender) +{ + Table1->Post(); + Table1->Insert(); + DBEdit1->SetFocus(); +} +//--------------------------------------------------------------------------- +void __fastcall TForm3::Button5Click(TObject *Sender) +{ + Table1->Prior(); +} +//--------------------------------------------------------------------------- +void __fastcall TForm3::Button2Click(TObject *Sender) +{ + Table1->Edit(); + Table1->Delete(); +} +//--------------------------------------------------------------------------- +void __fastcall TForm3::Button4Click(TObject *Sender) +{ + Close(); +} +//--------------------------------------------------------------------------- +void __fastcall TForm3::FormKeyPress(TObject *Sender, char &Key) +{ + if (Key=='\r') + Table1->Next(); +} +//--------------------------------------------------------------------------- +void __fastcall TForm3::Button3Click(TObject *Sender) +{ + TForm4 *Busqueda; + Busqueda = new TForm4(this); + busca = 2; + Busqueda->Table1->TableName = "recordatorio.db"; + Busqueda->Table1->Active=true; + Busqueda->ShowModal(); + delete Busqueda; + Table1->First(); + Table1->MoveBy(direccion); +} +//--------------------------------------------------------------------------- +void __fastcall TForm3::Button6Click(TObject *Sender) +{ + Table1->Next(); +} +//--------------------------------------------------------------------------- +void __fastcall TForm3::FormClose(TObject *Sender, TCloseAction &Action) +{ + if(Table1->State == dsInsert && Table1->Modified == true) + { + switch(MessageBox(Handle,"No guardó los datos ¿Desea Guardarlos?", "Atención" ,MB_YESNOCANCEL)) + { + case 6: + Table1->Post(); + break; + + default: + Table1->Cancel(); + break; + + } + } +} +//--------------------------------------------------------------------------- +void __fastcall TForm3::FormCreate(TObject *Sender) +{ + Table1->Insert(); +} +//--------------------------------------------------------------------------- diff --git a/Builder/agenda/Recuerda.dfm b/Builder/agenda/Recuerda.dfm new file mode 100644 index 0000000..10400dc Binary files /dev/null and b/Builder/agenda/Recuerda.dfm differ diff --git a/Builder/agenda/Recuerda.h b/Builder/agenda/Recuerda.h new file mode 100644 index 0000000..b9237b3 --- /dev/null +++ b/Builder/agenda/Recuerda.h @@ -0,0 +1,52 @@ +//--------------------------------------------------------------------------- +#ifndef RecuerdaH +#define RecuerdaH +//--------------------------------------------------------------------------- +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +//--------------------------------------------------------------------------- +class TForm3 : public TForm +{ +__published: // IDE-managed Components + TLabel *Label1; + TLabel *Label2; + TDBEdit *DBEdit1; + TDBEdit *DBEdit2; + TDataSource *DataSource1; + TTable *Table1; + TButton *Button1; + TButton *Button2; + TButton *Button4; + TButton *Button5; + TPanel *Panel1; + TButton *Button3; + TButton *Button6; + void __fastcall Button1Click(TObject *Sender); + void __fastcall Button5Click(TObject *Sender); + void __fastcall Button2Click(TObject *Sender); + void __fastcall Button4Click(TObject *Sender); + void __fastcall FormKeyPress(TObject *Sender, char &Key); + void __fastcall Button3Click(TObject *Sender); + + void __fastcall Button6Click(TObject *Sender); + + void __fastcall FormClose(TObject *Sender, TCloseAction &Action); + + void __fastcall FormCreate(TObject *Sender); +private: // User declarations +public: // User declarations + __fastcall TForm3(TComponent* Owner); +}; +//--------------------------------------------------------------------------- +extern TForm3 *Form3; +extern busca; +//--------------------------------------------------------------------------- +#endif diff --git a/Builder/agenda/agenda.MB b/Builder/agenda/agenda.MB new file mode 100644 index 0000000..af35059 Binary files /dev/null and b/Builder/agenda/agenda.MB differ diff --git a/Builder/agenda/agenda.PX b/Builder/agenda/agenda.PX new file mode 100644 index 0000000..2e548a4 Binary files /dev/null and b/Builder/agenda/agenda.PX differ diff --git a/Builder/agenda/agenda.db b/Builder/agenda/agenda.db new file mode 100644 index 0000000..f364a40 Binary files /dev/null and b/Builder/agenda/agenda.db differ diff --git a/Builder/agenda/bdiario.cpp b/Builder/agenda/bdiario.cpp new file mode 100644 index 0000000..219f08b --- /dev/null +++ b/Builder/agenda/bdiario.cpp @@ -0,0 +1,41 @@ +//--------------------------------------------------------------------------- +#include +#pragma hdrstop + +#include "agenda.h" +#include "bdiario.h" +#include "diario.h" +//--------------------------------------------------------------------------- +#pragma resource "*.dfm" +TForm7 *Form7; +//--------------------------------------------------------------------------- +__fastcall TForm7::TForm7(TComponent* Owner) + : TForm(Owner) +{ +} +//--------------------------------------------------------------------------- +void __fastcall TForm7::FormKeyPress(TObject *Sender, char &Key) +{ + if (dia==2 && Key=='+') + Table1->Next(); + if (dia==2 && Key=='-') + Table1->Prior(); +} +//--------------------------------------------------------------------------- +void __fastcall TForm7::FormActivate(TObject *Sender) +{ + if (dia==2) + { + Table1->First(); + } +} +//--------------------------------------------------------------------------- +void __fastcall TForm7::Edit1KeyPress(TObject *Sender, char &Key) +{ + TLocateOptions SearchOptions; + SearchOptions << loPartialKey; + if(Key=='\r') + if(Table1->Locate("Fecha", Edit1->Text, SearchOptions)==false) + ShowMessage("Fecha no encontrada"); +} +//--------------------------------------------------------------------------- diff --git a/Builder/agenda/bdiario.dfm b/Builder/agenda/bdiario.dfm new file mode 100644 index 0000000..365a378 Binary files /dev/null and b/Builder/agenda/bdiario.dfm differ diff --git a/Builder/agenda/bdiario.h b/Builder/agenda/bdiario.h new file mode 100644 index 0000000..83228b3 --- /dev/null +++ b/Builder/agenda/bdiario.h @@ -0,0 +1,38 @@ +//--------------------------------------------------------------------------- +#ifndef bdiarioH +#define bdiarioH +//--------------------------------------------------------------------------- +#include +#include +#include +#include +#include +#include +#include +#include +#include +//--------------------------------------------------------------------------- +class TForm7 : public TForm +{ +__published: // IDE-managed Components + TPanel *Panel1; + TLabel *Label1; + TDBMemo *DBMemo1; + TDBEdit *DBEdit1; + TDataSource *DataSource1; + TTable *Table1; + TEdit *Edit1; + void __fastcall FormKeyPress(TObject *Sender, char &Key); + void __fastcall FormActivate(TObject *Sender); + + + void __fastcall Edit1KeyPress(TObject *Sender, char &Key); + +private: // User declarations +public: // User declarations + __fastcall TForm7(TComponent* Owner); +}; +//--------------------------------------------------------------------------- +extern TForm7 *Form7; +//--------------------------------------------------------------------------- +#endif diff --git a/Builder/agenda/busqueda.cpp b/Builder/agenda/busqueda.cpp new file mode 100644 index 0000000..2c5aa39 --- /dev/null +++ b/Builder/agenda/busqueda.cpp @@ -0,0 +1,82 @@ +//--------------------------------------------------------------------------- +#include +#pragma hdrstop + +#include "busqueda.h" +#include "diario.h" +#include "recuerda.h" +#include "telefonos.h" +//--------------------------------------------------------------------------- +#pragma link "Grids" +#pragma resource "*.dfm" +int direccion; +TForm4 *Form4; +//--------------------------------------------------------------------------- +__fastcall TForm4::TForm4(TComponent* Owner) + : TForm(Owner) +{ +} +//--------------------------------------------------------------------------- +void __fastcall TForm4::ComboBox1Change(TObject *Sender) +{ + Edit1->SetFocus(); +} +//--------------------------------------------------------------------------- +void __fastcall TForm4::Edit1KeyPress(TObject *Sender, char &Key) +{ + TLocateOptions SearchOptions; + SearchOptions << loPartialKey; + switch(busca) + { + case 0: + if(Key=='\r') + Table1->Locate("Fecha", Edit1->Text, SearchOptions); + break; + + case 1: + if (ComboBox1->Text == "Nombre") + Table1->Locate("Nombre", Edit1->Text, SearchOptions); + else + Table1->Locate("Apodo", Edit1->Text, SearchOptions); + break; + + case 2: + if(Key=='\r') + Table1->Locate("Fecha", Edit1->Text, SearchOptions); + break; + + } +} +//--------------------------------------------------------------------------- +void __fastcall TForm4::FormActivate(TObject *Sender) +{ +ComboBox1->Clear(); +Edit1->Clear(); + +switch(busca) + { + + case 0: + ComboBox1->Text="Fecha"; + ComboBox1->Items->Add("Fecha"); + break; + + case 1: + ComboBox1->Text="Nombre"; + ComboBox1->Items->Add("Apodo"); + ComboBox1->Items->Add("Nombre"); + break; + + case 2: + ComboBox1->Text="Fecha"; + ComboBox1->Items->Add("Fecha"); + break; + + } +} +//--------------------------------------------------------------------------- +void __fastcall TForm4::FormClose(TObject *Sender, TCloseAction &Action) +{ + direccion = (Table1->RecNo) -1; +} +//--------------------------------------------------------------------------- diff --git a/Builder/agenda/busqueda.dfm b/Builder/agenda/busqueda.dfm new file mode 100644 index 0000000..f9c7f00 Binary files /dev/null and b/Builder/agenda/busqueda.dfm differ diff --git a/Builder/agenda/busqueda.h b/Builder/agenda/busqueda.h new file mode 100644 index 0000000..e276cf4 --- /dev/null +++ b/Builder/agenda/busqueda.h @@ -0,0 +1,43 @@ +//--------------------------------------------------------------------------- +#ifndef busquedaH +#define busquedaH +//--------------------------------------------------------------------------- +#include +#include +#include +#include +#include +#include "Grids.hpp" +#include +#include +//--------------------------------------------------------------------------- +class TForm4 : public TForm +{ +__published: // IDE-managed Components + TComboBox *ComboBox1; + TLabel *Label1; + TLabel *Label2; + TDBGrid *DBGrid1; + TEdit *Edit1; + TDataSource *DataSource1; + TTable *Table1; + void __fastcall ComboBox1Change(TObject *Sender); + + void __fastcall Edit1KeyPress(TObject *Sender, char &Key); + + void __fastcall FormActivate(TObject *Sender); + + + + + + void __fastcall FormClose(TObject *Sender, TCloseAction &Action); +private: // User declarations +public: // User declarations + __fastcall TForm4(TComponent* Owner); +}; +//--------------------------------------------------------------------------- +extern int direccion; +extern TForm4 *Form4; +//--------------------------------------------------------------------------- +#endif diff --git a/Builder/agenda/cleanup.bat b/Builder/agenda/cleanup.bat new file mode 100644 index 0000000..5e4c8b5 --- /dev/null +++ b/Builder/agenda/cleanup.bat @@ -0,0 +1,3 @@ +del *.~* +del *.tds +del *.obj diff --git a/Builder/agenda/diario.cpp b/Builder/agenda/diario.cpp new file mode 100644 index 0000000..0ffbb65 --- /dev/null +++ b/Builder/agenda/diario.cpp @@ -0,0 +1,93 @@ +//--------------------------------------------------------------------------- +#include +#pragma hdrstop + +#include "agenda.h" +#include "busqueda.h" +#include "diario.h" +#include "dos.h" +//--------------------------------------------------------------------------- +#pragma resource "*.dfm" +TForm6 *Form6; +int busca; +//--------------------------------------------------------------------------- +__fastcall TForm6::TForm6(TComponent* Owner) + : TForm(Owner) +{ +} +//--------------------------------------------------------------------------- +void __fastcall TForm6::Button1Click(TObject *Sender) +{ + Table1->FieldValues["Fecha"] = fecha; + Table1->Post(); + Table1->Insert(); +} +//--------------------------------------------------------------------------- +void __fastcall TForm6::Button3Click(TObject *Sender) +{ + Table1->Prior(); +} +//--------------------------------------------------------------------------- +void __fastcall TForm6::Button2Click(TObject *Sender) +{ + Table1->Edit(); + Table1->Delete(); +} +//--------------------------------------------------------------------------- +void __fastcall TForm6::Button5Click(TObject *Sender) +{ + Close(); +} +//--------------------------------------------------------------------------- +void __fastcall TForm6::Button4Click(TObject *Sender) +{ + TForm4 *Busqueda; + Busqueda = new TForm4(this); + busca = 0; + Busqueda->Table1->TableName = "agenda.db"; + Busqueda->Table1->Active=true; + Busqueda->ShowModal(); + delete Busqueda; + Table1->First(); + Table1->MoveBy(direccion); +} +//--------------------------------------------------------------------------- +void __fastcall TForm6::Button6Click(TObject *Sender) +{ + Table1->Next(); +} +//--------------------------------------------------------------------------- +void __fastcall TForm6::FormClose(TObject *Sender, TCloseAction &Action) +{ + if(Table1->State == dsInsert && DBMemo1 -> Modified ) + { + switch(MessageBox(Handle,"No guardó los datos ¿Desea Guardarlos?", "Atención" ,MB_YESNOCANCEL)) + { + case 6: + Table1->Post(); + break; + + default: + Table1->Cancel(); + break; + + } + } +} +//--------------------------------------------------------------------------- +void __fastcall TForm6::Table1NewRecord(TDataSet *DataSet) +{ +/* TLocateOptions SearchOptions; + SearchOptions << loPartialKey; + if(Table1->Locate("Fecha",Table1->FieldValues["Fecha"],SearchOptions)==true) + { + ShowMessage("Esta referencia ya existe"); + Table1->Cancel(); + }*/ +} +//--------------------------------------------------------------------------- +void __fastcall TForm6::FormCreate(TObject *Sender) +{ + Table1->Insert(); +} +//--------------------------------------------------------------------------- diff --git a/Builder/agenda/diario.dfm b/Builder/agenda/diario.dfm new file mode 100644 index 0000000..e99105d Binary files /dev/null and b/Builder/agenda/diario.dfm differ diff --git a/Builder/agenda/diario.h b/Builder/agenda/diario.h new file mode 100644 index 0000000..f71cb78 --- /dev/null +++ b/Builder/agenda/diario.h @@ -0,0 +1,58 @@ +//--------------------------------------------------------------------------- +#ifndef diarioH +#define diarioH +//--------------------------------------------------------------------------- +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +//--------------------------------------------------------------------------- +class TForm6 : public TForm +{ +__published: // IDE-managed Components + TPanel *Panel1; + TPanel *Panel2; + TLabel *Label2; + TPanel *Panel3; + TButton *Button1; + TButton *Button2; + TButton *Button3; + TButton *Button4; + TButton *Button5; + + + TDBMemo *DBMemo1; + TDataSource *DataSource1; + TTable *Table1; + TDBEdit *DBEdit1; + TButton *Button6; + void __fastcall Button1Click(TObject *Sender); + void __fastcall Button3Click(TObject *Sender); + void __fastcall Button2Click(TObject *Sender); + void __fastcall Button5Click(TObject *Sender); + void __fastcall Button4Click(TObject *Sender); + + + + + + void __fastcall Button6Click(TObject *Sender); + + void __fastcall FormClose(TObject *Sender, TCloseAction &Action); + void __fastcall Table1NewRecord(TDataSet *DataSet); + void __fastcall FormCreate(TObject *Sender); +private: // User declarations +public: // User declarations + __fastcall TForm6(TComponent* Owner); +}; +//--------------------------------------------------------------------------- +extern TForm6 *Form6; +extern busca; +//--------------------------------------------------------------------------- +#endif diff --git a/Builder/agenda/listado.cpp b/Builder/agenda/listado.cpp new file mode 100644 index 0000000..195dd42 --- /dev/null +++ b/Builder/agenda/listado.cpp @@ -0,0 +1,17 @@ +//--------------------------------------------------------------------------- +#include +#pragma hdrstop + +#include "telefonos.h" +#include "listado.h" +//--------------------------------------------------------------------------- +#pragma link "Grids" +#pragma resource "*.dfm" +TForm5 *Form5; +//--------------------------------------------------------------------------- +__fastcall TForm5::TForm5(TComponent* Owner) + : TForm(Owner) +{ +} +//--------------------------------------------------------------------------- + diff --git a/Builder/agenda/listado.dfm b/Builder/agenda/listado.dfm new file mode 100644 index 0000000..f413fe8 Binary files /dev/null and b/Builder/agenda/listado.dfm differ diff --git a/Builder/agenda/listado.h b/Builder/agenda/listado.h new file mode 100644 index 0000000..c780084 --- /dev/null +++ b/Builder/agenda/listado.h @@ -0,0 +1,30 @@ +//--------------------------------------------------------------------------- +#ifndef listadoH +#define listadoH +//--------------------------------------------------------------------------- +#include +#include +#include +#include +#include +#include +#include "Grids.hpp" +#include +#include +//--------------------------------------------------------------------------- +class TForm5 : public TForm +{ +__published: // IDE-managed Components + TPanel *Panel1; + TPanel *Panel2; + TDBGrid *DBGrid1; + TDataSource *DataSource1; + TTable *Table1; +private: // User declarations +public: // User declarations + __fastcall TForm5(TComponent* Owner); +}; +//--------------------------------------------------------------------------- +extern TForm5 *Form5; +//--------------------------------------------------------------------------- +#endif diff --git a/Builder/agenda/telefonos.PX b/Builder/agenda/telefonos.PX new file mode 100644 index 0000000..54b2f23 Binary files /dev/null and b/Builder/agenda/telefonos.PX differ diff --git a/Builder/agenda/telefonos.VAL b/Builder/agenda/telefonos.VAL new file mode 100644 index 0000000..db0931d Binary files /dev/null and b/Builder/agenda/telefonos.VAL differ diff --git a/Builder/agenda/telefonos.cpp b/Builder/agenda/telefonos.cpp new file mode 100644 index 0000000..26bb3ec --- /dev/null +++ b/Builder/agenda/telefonos.cpp @@ -0,0 +1,82 @@ +//--------------------------------------------------------------------------- +#include +#pragma hdrstop + +#include "busqueda.h" +#include "telefonos.h" +//--------------------------------------------------------------------------- +#pragma resource "*.dfm" +TForm2 *Form2; +//--------------------------------------------------------------------------- +__fastcall TForm2::TForm2(TComponent* Owner) + : TForm(Owner) +{ +} +//--------------------------------------------------------------------------- +void __fastcall TForm2::Button4Click(TObject *Sender) +{ + Close(); +} +//--------------------------------------------------------------------------- +void __fastcall TForm2::Button5Click(TObject *Sender) +{ + Table1->Prior(); +} +//--------------------------------------------------------------------------- +void __fastcall TForm2::Button1Click(TObject *Sender) +{ + Table1->Post(); + Table1->Insert(); + DBEdit1->SetFocus(); +} +//--------------------------------------------------------------------------- +void __fastcall TForm2::Button2Click(TObject *Sender) +{ + Table1->Delete(); +} +//--------------------------------------------------------------------------- +void __fastcall TForm2::Button3Click(TObject *Sender) +{ + TForm4 *Busqueda; + Busqueda = new TForm4(this); + busca = 1; + Busqueda->Table1->TableName = "telefonos.db"; + Busqueda->Table1->Active=true; + Busqueda->ShowModal(); + delete Busqueda; + Table1->First(); + Table1->MoveBy(direccion); +} +//--------------------------------------------------------------------------- + +void __fastcall TForm2::Button6Click(TObject *Sender) +{ + Table1->Next(); +} +//--------------------------------------------------------------------------- +void __fastcall TForm2::FormClose(TObject *Sender, TCloseAction &Action) +{ + if(Table1->State == dsInsert && Table1->Modified == true) + { + switch(MessageBox(Handle,"No guardó los datos ¿Desea Guardarlos?", "Atención" ,MB_YESNOCANCEL)) + { + case 6: + Table1->Post(); + break; + + default: + Table1->Cancel(); + break; + } + } + else + { + Table1->Cancel(); + } +} +//--------------------------------------------------------------------------- +void __fastcall TForm2::FormCreate(TObject *Sender) +{ + Table1->Insert(); +} +//--------------------------------------------------------------------------- diff --git a/Builder/agenda/telefonos.db b/Builder/agenda/telefonos.db new file mode 100644 index 0000000..09fa09e Binary files /dev/null and b/Builder/agenda/telefonos.db differ diff --git a/Builder/agenda/telefonos.dfm b/Builder/agenda/telefonos.dfm new file mode 100644 index 0000000..178560d Binary files /dev/null and b/Builder/agenda/telefonos.dfm differ diff --git a/Builder/agenda/telefonos.h b/Builder/agenda/telefonos.h new file mode 100644 index 0000000..34f842f --- /dev/null +++ b/Builder/agenda/telefonos.h @@ -0,0 +1,69 @@ +//--------------------------------------------------------------------------- +#ifndef telefonosH +#define telefonosH +//--------------------------------------------------------------------------- +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +//--------------------------------------------------------------------------- +class TForm2 : public TForm +{ +__published: // IDE-managed Components + TPanel *Panel1; + TPanel *Panel2; + TLabel *Label1; + TLabel *Label2; + TLabel *Label3; + TDataSource *DataSource1; + TDBEdit *DBEdit1; + TDBEdit *DBEdit2; + TDBEdit *DBEdit3; + TPanel *Panel3; + TButton *Button1; + TButton *Button2; + TButton *Button3; + TButton *Button4; + TButton *Button5; + TTable *Table1; + TButton *Button6; + void __fastcall Button4Click(TObject *Sender); + void __fastcall Button5Click(TObject *Sender); + void __fastcall Button1Click(TObject *Sender); + void __fastcall Button2Click(TObject *Sender); + void __fastcall Button3Click(TObject *Sender); + + void __fastcall Button6Click(TObject *Sender); + + + void __fastcall FormClose(TObject *Sender, TCloseAction &Action); + + + + void __fastcall FormCreate(TObject *Sender); + + + + + + + + + + + +private: // User declarations +public: // User declarations + __fastcall TForm2(TComponent* Owner); +}; +//--------------------------------------------------------------------------- +extern TForm2 *Form2; +extern busca; +//--------------------------------------------------------------------------- +#endif diff --git a/Builder/barmatic/Repartidores.db b/Builder/barmatic/Repartidores.db new file mode 100644 index 0000000..dccc52b Binary files /dev/null and b/Builder/barmatic/Repartidores.db differ diff --git a/Builder/barmatic/articulo.DB b/Builder/barmatic/articulo.DB new file mode 100644 index 0000000..fc29544 Binary files /dev/null and b/Builder/barmatic/articulo.DB differ diff --git a/Builder/barmatic/articulos.cpp b/Builder/barmatic/articulos.cpp new file mode 100644 index 0000000..afa400a --- /dev/null +++ b/Builder/barmatic/articulos.cpp @@ -0,0 +1,66 @@ +//--------------------------------------------------------------------------- +#include +#pragma hdrstop + +#include "articulos.h" +//--------------------------------------------------------------------------- +#pragma resource "*.dfm" +TForm2 *Form2; +//--------------------------------------------------------------------------- +__fastcall TForm2::TForm2(TComponent* Owner) + : TForm(Owner) +{ +} +//--------------------------------------------------------------------------- +void __fastcall TForm2::Button6Click(TObject *Sender) +{ + Panel3->Caption = "Busca Artículo"; +} +//--------------------------------------------------------------------------- +void __fastcall TForm2::Button1Click(TObject *Sender) +{ + Panel3->Caption = "Crea Artículo"; + Table1->Edit(); + Table1->Insert(); + DBEdit1->SetFocus(); +} +//--------------------------------------------------------------------------- +void __fastcall TForm2::Button2Click(TObject *Sender) +{ + Panel3->Caption = "Modifica Artículo"; + Table1->Edit(); + Table1->Post(); +} +//--------------------------------------------------------------------------- +void __fastcall TForm2::Button3Click(TObject *Sender) +{ + Panel3->Caption = "Borra Artículo"; + Table1->Edit(); + Table1->Delete(); +} +//--------------------------------------------------------------------------- +void __fastcall TForm2::Button4Click(TObject *Sender) +{ + int registro; + Panel3->Caption = "Siguiente Artículo"; + Table1->Next(); + registro = Table1->RecNo; + Label3->Caption = registro; +} +//--------------------------------------------------------------------------- +void __fastcall TForm2::Button5Click(TObject *Sender) +{ + int registro; + Panel3->Caption = "Anterior Artículo"; + Table1->Prior(); + registro = Table1->RecNo; + Label3->Caption = registro; +} +//--------------------------------------------------------------------------- +void __fastcall TForm2::FormActivate(TObject *Sender) +{ + int registro; + registro = Table1->RecNo; + Label3->Caption = registro; +} +//--------------------------------------------------------------------------- diff --git a/Builder/barmatic/articulos.dfm b/Builder/barmatic/articulos.dfm new file mode 100644 index 0000000..5c41b58 Binary files /dev/null and b/Builder/barmatic/articulos.dfm differ diff --git a/Builder/barmatic/articulos.h b/Builder/barmatic/articulos.h new file mode 100644 index 0000000..51127a1 --- /dev/null +++ b/Builder/barmatic/articulos.h @@ -0,0 +1,75 @@ +//--------------------------------------------------------------------------- +#ifndef articulosH +#define articulosH +//--------------------------------------------------------------------------- +#include +#include +#include +#include +#include +#include +#include +#include +#include +//--------------------------------------------------------------------------- +class TForm2 : public TForm +{ +__published: // IDE-managed Components + TPanel *Panel1; + TLabel *Label1; + TLabel *Label2; + TLabel *Label3; + TPanel *Panel2; + TPanel *Panel3; + TLabel *Label4; + TLabel *Label5; + TLabel *Label6; + TLabel *Label7; + TLabel *Label8; + TLabel *Label9; + TLabel *Label10; + TLabel *Label11; + TLabel *Label12; + TLabel *Label13; + TLabel *Label14; + TLabel *Label15; + TLabel *Label16; + TLabel *Label17; + TDataSource *DataSource1; + TTable *Table1; + TDBEdit *DBEdit1; + TDBEdit *DBEdit2; + TDBEdit *DBEdit3; + TDBEdit *DBEdit4; + TDBEdit *DBEdit5; + TDBEdit *DBEdit6; + TDBEdit *DBEdit7; + TDBEdit *DBEdit8; + TDBEdit *DBEdit9; + TButton *Button1; + TButton *Button2; + TButton *Button3; + TButton *Button4; + TButton *Button5; + TButton *Button6; + void __fastcall Button6Click(TObject *Sender); + void __fastcall Button1Click(TObject *Sender); + void __fastcall Button2Click(TObject *Sender); + void __fastcall Button3Click(TObject *Sender); + void __fastcall Button4Click(TObject *Sender); + void __fastcall Button5Click(TObject *Sender); + + + void __fastcall FormActivate(TObject *Sender); + + + + +private: // User declarations +public: // User declarations + __fastcall TForm2(TComponent* Owner); +}; +//--------------------------------------------------------------------------- +extern TForm2 *Form2; +//--------------------------------------------------------------------------- +#endif diff --git a/Builder/barmatic/barmati.cpp b/Builder/barmatic/barmati.cpp new file mode 100644 index 0000000..cb1ddb3 --- /dev/null +++ b/Builder/barmatic/barmati.cpp @@ -0,0 +1,84 @@ +//--------------------------------------------------------------------------- +#include +#pragma hdrstop + +#include "articulos.h" +#include "barmati.h" +#include "claves.h" +#include "listado.h" +#include "repartidores.h" +//--------------------------------------------------------------------------- +#pragma resource "*.dfm" +TForm1 *Form1; +int acceso; +String clave = "bar"; +//--------------------------------------------------------------------------- +__fastcall TForm1::TForm1(TComponent* Owner) + : TForm(Owner) +{ +} +//--------------------------------------------------------------------------- +void __fastcall TForm1::Salida2Click(TObject *Sender) +{ + Close(); +} +//--------------------------------------------------------------------------- +void __fastcall TForm1::Creditos1Click(TObject *Sender) +{ + ShowMessage("Barmatic 1.0 \nProgramado por OGA."); +} +//--------------------------------------------------------------------------- +void __fastcall TForm1::ModificarArticulo1Click(TObject *Sender) +{ + Form2->Visible=true; + Form2->Panel3->Caption = "Elija Opción", + Form2->Table1->Edit(); + Form2->Table1->Insert(); + Form2->DBEdit1->SetFocus(); +} +//--------------------------------------------------------------------------- +void __fastcall TForm1::ListadosdeProductos1Click(TObject *Sender) +{ + Form3->DataSource1->DataSet = Form3->Table1; + Form3->Visible=true; +} +//--------------------------------------------------------------------------- +void __fastcall TForm1::ListadosdeStocksbajos1Click(TObject *Sender) +{ +//Query1->Prepare(); +// Form3->Table1->Filtered = true; +// Form3->Table1->FieldValues["Minimo_stock"]; +// Form3->Table1->Filter = " Unidades_actuales > 0"; +// Form3->Table1->Refresh(); +// TLocateOptions SearchOptions; +// SearchOptions << loPartialKey; +// Form3->Table1->Locate("cod-ariculo", "Professional Divers, Ltd.", +// SearchOptions); +// Form3->Query1->Close(); +// Form3->Query1->SQL->Add("SELECT * FROM articulo WHERE Minimo_stock > Unidades_actuales"); +// Form3->Query1->Active=true; +// Form3->Query1->Open(); +// Form3->Table1->Refresh(); + Form3->DataSource1->DataSet = Form3->Query1; + Form3->Visible=true; +} +//--------------------------------------------------------------------------- +void __fastcall TForm1::N1Click(TObject *Sender) +{ + acceso=1; + Form4->Edit1->Clear(); + Form4->Visible=true; +} +//--------------------------------------------------------------------------- +void __fastcall TForm1::Cambiarclave1Click(TObject *Sender) +{ + acceso=2; + Form4->Edit1->Clear(); + Form4->Visible=true; +} +//--------------------------------------------------------------------------- +void __fastcall TForm1::Repartidores1Click(TObject *Sender) +{ + Form5->Visible=true; +} +//--------------------------------------------------------------------------- diff --git a/Builder/barmatic/barmati.dfm b/Builder/barmatic/barmati.dfm new file mode 100644 index 0000000..080142c Binary files /dev/null and b/Builder/barmatic/barmati.dfm differ diff --git a/Builder/barmatic/barmati.h b/Builder/barmatic/barmati.h new file mode 100644 index 0000000..9d0bb18 --- /dev/null +++ b/Builder/barmatic/barmati.h @@ -0,0 +1,78 @@ +//--------------------------------------------------------------------------- +#ifndef barmatiH +#define barmatiH +//--------------------------------------------------------------------------- +#include +#include +#include +#include +#include +#include +#include +#include +//--------------------------------------------------------------------------- +class TForm1 : public TForm +{ +__published: // IDE-managed Components + TMainMenu *MainMenu1; + TMenuItem *BasedeDatos1; + TMenuItem *Accesos1; + TMenuItem *Listados1; + TMenuItem *Mesas1; + TMenuItem *Salida1; + TMenuItem *Creditos1; + TMenuItem *Salida2; + TMenuItem *ModificarArticulo1; + TMenuItem *CajayAlmacen1; + TMenuItem *MantenimientoFactura1; + TMenuItem *Repartidores1; + TMenuItem *ClientesDomicilio1; + TMenuItem *N1; + TMenuItem *Cambiarclave1; + TMenuItem *ListadosdeProductos1; + TMenuItem *ListadosdeStocksbajos1; + TMenuItem *Abrirunamesa1; + TMenuItem *Consultarmesa1; + TMenuItem *Reservarmesa1; + TMenuItem *Facturarmesa1; + TMenuItem *Cambiarmesa1; + TPanel *Panel1; + TLabel *Label1; + TLabel *Label2; + TLabel *Label3; + TLabel *Label4; + TPanel *Panel2; + TPanel *Panel3; + TLabel *Label5; + TLabel *Label6; + TLabel *Label7; + TLabel *Label8; + TLabel *Label9; + TListBox *ListBox1; + TListBox *ListBox2; + TListBox *ListBox3; + TListBox *ListBox4; + TPanel *Panel4; + TLabel *Label10; + void __fastcall Salida2Click(TObject *Sender); + void __fastcall Creditos1Click(TObject *Sender); + + + + + void __fastcall ModificarArticulo1Click(TObject *Sender); + void __fastcall ListadosdeProductos1Click(TObject *Sender); + void __fastcall ListadosdeStocksbajos1Click(TObject *Sender); + void __fastcall N1Click(TObject *Sender); + void __fastcall Cambiarclave1Click(TObject *Sender); + void __fastcall Repartidores1Click(TObject *Sender); +private: // User declarations +public: // User declarations + __fastcall TForm1(TComponent* Owner); +}; +//--------------------------------------------------------------------------- +extern TForm1 *Form1; +extern acceso; +extern String clave; +//--------------------------------------------------------------------------- +#endif diff --git a/Builder/barmatic/barmatic.cpp b/Builder/barmatic/barmatic.cpp new file mode 100644 index 0000000..e1109be --- /dev/null +++ b/Builder/barmatic/barmatic.cpp @@ -0,0 +1,30 @@ +//--------------------------------------------------------------------------- +#include +#pragma hdrstop +//--------------------------------------------------------------------------- +USEFORM("barmati.cpp", Form1); +USERES("barmatic.res"); +USEFORM("articulos.cpp", Form2); +USEFORM("listado.cpp", Form3); +USEFORM("claves.cpp", Form4); +USEFORM("repartidores.cpp", Form5); +//--------------------------------------------------------------------------- +WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int) +{ + try + { + Application->Initialize(); + Application->CreateForm(__classid(TForm1), &Form1); + Application->CreateForm(__classid(TForm2), &Form2); + Application->CreateForm(__classid(TForm3), &Form3); + Application->CreateForm(__classid(TForm4), &Form4); + Application->CreateForm(__classid(TForm5), &Form5); + Application->Run(); + } + catch (Exception &exception) + { + Application->ShowException(&exception); + } + return 0; +} +//--------------------------------------------------------------------------- diff --git a/Builder/barmatic/barmatic.mak b/Builder/barmatic/barmatic.mak new file mode 100644 index 0000000..8b16ed9 --- /dev/null +++ b/Builder/barmatic/barmatic.mak @@ -0,0 +1,59 @@ +# --------------------------------------------------------------------------- +VERSION = BCB.01 +# --------------------------------------------------------------------------- +!ifndef BCB +BCB = $(MAKEDIR)\.. +!endif +# --------------------------------------------------------------------------- +PROJECT = barmatic.exe +OBJFILES = barmatic.obj barmati.obj articulos.obj listado.obj claves.obj \ + repartidores.obj +RESFILES = barmatic.res +RESDEPEN = $(RESFILES) barmati.dfm articulos.dfm listado.dfm claves.dfm \ + repartidores.dfm +LIBFILES = +DEFFILE = +# --------------------------------------------------------------------------- +CFLAG1 = -Od -Hc -w -k -r- -y -v -vi- -c -a4 -b- -w-par -w-inl -Vx -Ve -x +CFLAG2 = -I$(BCB)\projects;$(BCB)\include;$(BCB)\include\vcl \ + -H=$(BCB)\lib\vcld.csm +PFLAGS = -U$(BCB)\projects;$(BCB)\lib\obj;$(BCB)\lib \ + -I$(BCB)\projects;$(BCB)\include;$(BCB)\include\vcl \ + -AWinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE -v \ + -$Y -$W -$O- -JPHNV -M +RFLAGS = -i$(BCB)\projects;$(BCB)\include;$(BCB)\include\vcl +LFLAGS = -L$(BCB)\projects;$(BCB)\lib\obj;$(BCB)\lib -aa -Tpe -x -v -V4.0 +IFLAGS = +LINKER = ilink32 +# --------------------------------------------------------------------------- +ALLOBJ = c0w32.obj $(OBJFILES) +ALLRES = $(RESFILES) +ALLLIB = $(LIBFILES) vcl.lib import32.lib cp32mt.lib +# --------------------------------------------------------------------------- +.autodepend + +$(PROJECT): $(OBJFILES) $(RESDEPEN) $(DEFFILE) + $(BCB)\BIN\$(LINKER) @&&! + $(LFLAGS) + + $(ALLOBJ), + + $(PROJECT),, + + $(ALLLIB), + + $(DEFFILE), + + $(ALLRES) +! + +.pas.hpp: + $(BCB)\BIN\dcc32 $(PFLAGS) { $** } + +.pas.obj: + $(BCB)\BIN\dcc32 $(PFLAGS) { $** } + +.cpp.obj: + $(BCB)\BIN\bcc32 $(CFLAG1) $(CFLAG2) -o$* $* + +.c.obj: + $(BCB)\BIN\bcc32 $(CFLAG1) $(CFLAG2) -o$* $** + +.rc.res: + $(BCB)\BIN\brcc32 $(RFLAGS) $< +#----------------------------------------------------------------------------- diff --git a/Builder/barmatic/barmatic.res b/Builder/barmatic/barmatic.res new file mode 100644 index 0000000..79b1d56 Binary files /dev/null and b/Builder/barmatic/barmatic.res differ diff --git a/Builder/barmatic/claves.cpp b/Builder/barmatic/claves.cpp new file mode 100644 index 0000000..18aa8e5 --- /dev/null +++ b/Builder/barmatic/claves.cpp @@ -0,0 +1,45 @@ +//--------------------------------------------------------------------------- +#include +#pragma hdrstop + +#include "barmati.h" +#include "claves.h" +//--------------------------------------------------------------------------- +#pragma resource "*.dfm" +TForm4 *Form4; +//--------------------------------------------------------------------------- +__fastcall TForm4::TForm4(TComponent* Owner) + : TForm(Owner) +{ +} +//--------------------------------------------------------------------------- +void __fastcall TForm4::Edit1KeyPress(TObject *Sender, char &Key) +{ + if (Key=='\r' && Edit1->Text == clave) + { + ShowMessage("Clave correcta"); + if (acceso==2) + { + Label2->Visible=true; + Edit2->Visible=true; + Edit2->SetFocus(); + } + else + Form4->Visible=false; + } + else if (Key=='\r') + ShowMessage("Clave incorrecta"); +} +//--------------------------------------------------------------------------- +void __fastcall TForm4::Edit2KeyPress(TObject *Sender, char &Key) +{ + if (Key=='\r') + { + clave = Edit2->Text; + Edit2->Clear(); + Label2->Visible=false; + Edit2->Visible=false; + Form4->Visible=false; + } +} +//--------------------------------------------------------------------------- \ No newline at end of file diff --git a/Builder/barmatic/claves.dfm b/Builder/barmatic/claves.dfm new file mode 100644 index 0000000..072a4de Binary files /dev/null and b/Builder/barmatic/claves.dfm differ diff --git a/Builder/barmatic/claves.h b/Builder/barmatic/claves.h new file mode 100644 index 0000000..b9cdc7a --- /dev/null +++ b/Builder/barmatic/claves.h @@ -0,0 +1,28 @@ +//--------------------------------------------------------------------------- +#ifndef clavesH +#define clavesH +//--------------------------------------------------------------------------- +#include +#include +#include +#include +#include +//--------------------------------------------------------------------------- +class TForm4 : public TForm +{ +__published: // IDE-managed Components + TPanel *Panel1; + TLabel *Label1; + TEdit *Edit1; + TLabel *Label2; + TEdit *Edit2; + void __fastcall Edit1KeyPress(TObject *Sender, char &Key); + void __fastcall Edit2KeyPress(TObject *Sender, char &Key); +private: // User declarations +public: // User declarations + __fastcall TForm4(TComponent* Owner); +}; +//--------------------------------------------------------------------------- +extern TForm4 *Form4; +//--------------------------------------------------------------------------- +#endif diff --git a/Builder/barmatic/clientes.db b/Builder/barmatic/clientes.db new file mode 100644 index 0000000..3d17fff Binary files /dev/null and b/Builder/barmatic/clientes.db differ diff --git a/Builder/barmatic/listado.cpp b/Builder/barmatic/listado.cpp new file mode 100644 index 0000000..6b7e1f2 --- /dev/null +++ b/Builder/barmatic/listado.cpp @@ -0,0 +1,15 @@ +//--------------------------------------------------------------------------- +#include +#pragma hdrstop + +#include "listado.h" +//--------------------------------------------------------------------------- +#pragma link "Grids" +#pragma resource "*.dfm" +TForm3 *Form3; +//--------------------------------------------------------------------------- +__fastcall TForm3::TForm3(TComponent* Owner) + : TForm(Owner) +{ +} +//--------------------------------------------------------------------------- diff --git a/Builder/barmatic/listado.dfm b/Builder/barmatic/listado.dfm new file mode 100644 index 0000000..b299e46 Binary files /dev/null and b/Builder/barmatic/listado.dfm differ diff --git a/Builder/barmatic/listado.h b/Builder/barmatic/listado.h new file mode 100644 index 0000000..c1fa191 --- /dev/null +++ b/Builder/barmatic/listado.h @@ -0,0 +1,33 @@ +//--------------------------------------------------------------------------- +#ifndef listadoH +#define listadoH +//--------------------------------------------------------------------------- +#include +#include +#include +#include +#include +#include "Grids.hpp" +#include +#include +#include +//--------------------------------------------------------------------------- +class TForm3 : public TForm +{ +__published: // IDE-managed Components + TDataSource *DataSource1; + TTable *Table1; + TQuery *Query1; + TDBGrid *DBGrid1; + TStringField *Query1Codarticulo; + TStringField *Query1Descripcion; + TIntegerField *Query1Precio_compra; + TIntegerField *Query1Unidades_actuales; +private: // User declarations +public: // User declarations + __fastcall TForm3(TComponent* Owner); +}; +//--------------------------------------------------------------------------- +extern TForm3 *Form3; +//--------------------------------------------------------------------------- +#endif diff --git a/Builder/barmatic/repartidores.cpp b/Builder/barmatic/repartidores.cpp new file mode 100644 index 0000000..e9d8a36 --- /dev/null +++ b/Builder/barmatic/repartidores.cpp @@ -0,0 +1,33 @@ +//--------------------------------------------------------------------------- +#include +#pragma hdrstop + +#include "repartidores.h" +//--------------------------------------------------------------------------- +#pragma resource "*.dfm" +TForm5 *Form5; +//--------------------------------------------------------------------------- +__fastcall TForm5::TForm5(TComponent* Owner) + : TForm(Owner) +{ +} +//--------------------------------------------------------------------------- +void __fastcall TForm5::Button1Click(TObject *Sender) +{ + Table1->Edit(); + Table1->Insert(); + DBEdit1->SetFocus(); +} +//--------------------------------------------------------------------------- +void __fastcall TForm5::Button2Click(TObject *Sender) +{ + Table1->Edit(); + Table1->Delete(); +} +//--------------------------------------------------------------------------- +void __fastcall TForm5::Button3Click(TObject *Sender) +{ + Table1->Edit(); + Table1->Post(); +} +//--------------------------------------------------------------------------- \ No newline at end of file diff --git a/Builder/barmatic/repartidores.dfm b/Builder/barmatic/repartidores.dfm new file mode 100644 index 0000000..08a5f50 Binary files /dev/null and b/Builder/barmatic/repartidores.dfm differ diff --git a/Builder/barmatic/repartidores.h b/Builder/barmatic/repartidores.h new file mode 100644 index 0000000..5700a1d --- /dev/null +++ b/Builder/barmatic/repartidores.h @@ -0,0 +1,41 @@ +//--------------------------------------------------------------------------- +#ifndef repartidoresH +#define repartidoresH +//--------------------------------------------------------------------------- +#include +#include +#include +#include +#include +#include +#include +#include +#include +//--------------------------------------------------------------------------- +class TForm5 : public TForm +{ +__published: // IDE-managed Components + TPanel *Panel1; + TLabel *Label1; + TLabel *Label3; + TPanel *Panel2; + TLabel *Label2; + TButton *Button1; + TButton *Button2; + TButton *Button3; + TButton *Button4; + TTable *Table1; + TDataSource *DataSource1; + TDBEdit *DBEdit1; + TPanel *Panel3; + void __fastcall Button1Click(TObject *Sender); + void __fastcall Button2Click(TObject *Sender); + void __fastcall Button3Click(TObject *Sender); +private: // User declarations +public: // User declarations + __fastcall TForm5(TComponent* Owner); +}; +//--------------------------------------------------------------------------- +extern TForm5 *Form5; +//--------------------------------------------------------------------------- +#endif diff --git a/C.CPP b/C.CPP new file mode 100644 index 0000000..a6bb70f --- /dev/null +++ b/C.CPP @@ -0,0 +1,885 @@ +//PROYECTO DE PROGRAMACION +//BIBLIOTECAS EMPLEADAS +#include +#include +#include +#include +#include +//DECLARACION DE FUNCIONES +typedef union guarda{ + char matriz1[4]; + char matriz2[74]; + } OPCION; +OPCION cap; +void captura(int tam, char intochar, OPCION cap,char nombre[20]); +void recuadro(int x,int y,int x1,int y1,int o); +void dibujaeleccion(int opcion); +void dibujasubmenu1(int opcion); +void alumnos(int subopcion,int subopcion1,int subopcion2); +void menu(); +//VARIABLES GLOBALES +typedef struct reg { + char apellido_alumno[20]; + char nombre_alumno[15]; + int n_matricula; + char nombre_asig[16][3]; + char estado_asig[16][3]; + int notas[16]; + int fj[16]; + int fn[16]; + } ALUMNO_E3; + +typedef struct reg1{ + char apellido_alumno[20]; + char nombre_alumno[15]; + int n_matricula; + char nombre_asig[21][3]; + char estado_asig[21][3]; + int notas[21]; + int fj[21]; + int fn[21]; + } ALUMNO_E4; + +typedef struct reg2{ + char apellido_alumno[20]; + char nombre_alumno[15]; + int n_matricula; + char nombre_asig[15][3]; + char estado_asig[15][3]; + int notas[15]; + int fj[15]; + int fn[15]; + } ALUMNO_B1; + +typedef struct reg3{ + char apellido_alumno[20]; + char nombre_alumno[15]; + int n_matricula; + char nombre_asig[18][3]; + char estado_asig[18][3]; + int notas[18]; + int fj[18]; + int fn[18]; + } ALUMNO_B2; + +typedef struct reg4{ + char apellido_alumno[20]; + char nombre_alumno[15]; + int n_matricula; + char nombre_asig[4][3]; + char estado_asig[4][3]; + int notas[4]; + int fj[4]; + int fn[4]; + } ALUMNO_C1; + +typedef struct reg5{ + char apellido_alumno[20]; + char nombre_alumno[15]; + int n_matricula; + char nombre_asig[5][3]; + char estado_asig[5][3]; + int notas[5]; + int fj[5]; + int fn[5]; + } ALUMNO_C2; + +char ESO3[16][3]={"CN","CS","EF","PM","LC","I1","F1","MA","TE","RE","AE","I2", + "F2","EC","PC","TA"}; +char ESO4[21][3]={"FQ","CN","CS","VM","EF","EP","LC","I1","F1","MA","MU","TE", + "RE","AE","I2","F2","CC","OE","IA","TX","IC"}; +char BCN1[15][3]={"LC","I1","F1","FL","EF","RE","AR","BG","FQ","MA","I1","F2", + "MC","IA","EC"}; +char BCN2[18][3]={"LC","I1","F1","HI","RE","AR","DI","FI","MA","BI","CI","QU", + "I2","F2","ES","GE","BC","HP"}; +char CFGS1[4][3]={"SI","AD","PL","IA"}; +char CFGS2[5][3]={"DA","DR","RE","FO","PF"}; +char busca[1][3]; +//FUNCION PRINCIPAL +void main() +{ +int a=0,opcion=1; +textbackground(0); +_setcursortype(_NOCURSOR); +menu(); +while(opcion!=6||a!=7181) + { + dibujaeleccion(opcion); + if(a==7181) dibujasubmenu1(opcion); + a=bioskey(0); + if(a==19712) opcion++; + if(a==19200) opcion--; + if(opcion==0) opcion=6; + if(opcion==7) opcion=1; + } +clrscr(); +} +/////////////////////////////////FUNCIONES/////////////////////////////////// +//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 LA ELECCION DE MENU GENERAL +void dibujaeleccion(int opcion) +{ +//clrscr(); +textcolor(LIGHTGRAY); +textattr(127); +gotoxy(3,1); +cprintf("ALUMNOS CALIFICACIONES Y FALTAS BOLETINES ACTA DE E. SESION DE E. FINALIZAR"); +gotoxy(3,25); +cprintf("F1 ayuda"); +textattr(LIGHTGRAY); +switch(opcion) + { + case 1:gotoxy(3,1);cprintf("ALUMNOS");break; + case 2:gotoxy(11,1);cprintf("CALIFICACIONES Y FALTAS");break; + case 3:gotoxy(35,1);cprintf("BOLETINES");break; + case 4:gotoxy(45,1);cprintf("ACTA DE E.");break; + case 5:gotoxy(56,1);cprintf("SESION DE E.");break; + case 6:gotoxy(69,1);cprintf("FINALIZAR");break; + } +} +//DIBUJA SUBMENUS +void dibujasubmenu1(int opcion) +{ +int a=0,subopcion=1,subopcion1=1,subopcion2=1; +recuadro(30,8,50,16,2); +while(a!=7181) + { + textattr(127); + gotoxy(38,9); + cprintf("E.S.O."); + gotoxy(38,12); + cprintf("B.C.N."); + gotoxy(37,15); + cprintf("C.F.G.S."); + textattr(LIGHTGRAY); + switch(subopcion) + { + case 1:gotoxy(38,9);cprintf("E.S.O.");break; + case 2:gotoxy(38,12);cprintf("B.C.N.");break; + case 3:gotoxy(37,15);cprintf("C.F.G.S.");break; + } + a=bioskey(0); + if(a==20480) subopcion++; + if(a==18432) subopcion--; + if(subopcion==0) subopcion=3; + if(subopcion==4) subopcion=1; + } +a=0; +recuadro(52,8,72,16,2); +switch(subopcion) + { + case 1: while(a!=7181) + { + textattr(127); + gotoxy(58,9);cprintf("3§E.S.O. A"); + gotoxy(58,11);cprintf("3§E.S.O. B"); + gotoxy(58,13);cprintf("4§E.S.O. A"); + gotoxy(58,15);cprintf("4§E.S.O. B"); + textattr(LIGHTGRAY); + switch(subopcion1) + { + case 1: gotoxy(58,9);cprintf("3§E.S.O. A");break; + case 2: gotoxy(58,11);cprintf("3§E.S.O. B");break; + case 3: gotoxy(58,13);cprintf("4§E.S.O. A");break; + case 4: gotoxy(58,15);cprintf("4§E.S.O. B");break; + } + a=bioskey(0); + if(a==20480) subopcion1++; + if(a==18432) subopcion1--; + if(subopcion1==0) subopcion1=4; + if(subopcion1==5) subopcion1=1; + } + break; + case 2: while(a!=7181) + { + textattr(127); + gotoxy(58,9);cprintf("1§B.C.N. A"); + gotoxy(58,11);cprintf("1§B.C.N. B"); + gotoxy(58,13);cprintf("2§B.C.N. A"); + gotoxy(58,15);cprintf("2§B.C.N. B"); + textattr(LIGHTGRAY); + switch(subopcion1) + { + case 1: gotoxy(58,9);cprintf("1§B.C.N. A");break; + case 2: gotoxy(58,11);cprintf("1§B.C.N. B");break; + case 3: gotoxy(58,13);cprintf("2§B.C.N. A");break; + case 4: gotoxy(58,15);cprintf("2§B.C.N. B");break; + } + a=bioskey(0); + if(a==20480) subopcion1++; + if(a==18432) subopcion1--; + if(subopcion1==0) subopcion1=4; + if(subopcion1==5) subopcion1=1; + } + break; + case 3: while(a!=7181) + { + textattr(127); + gotoxy(56,10);cprintf("1§C.F.G.S. A"); + gotoxy(56,12);cprintf("1§C.F.G.S. B"); + gotoxy(56,14);cprintf("2§C.F.G.S. "); + textattr(LIGHTGRAY); + switch(subopcion1) + { + case 1: gotoxy(56,10);cprintf("1§C.F.G.S. A");break; + case 2: gotoxy(56,12);cprintf("1§C.F.G.S. B");break; + case 3: gotoxy(56,14);cprintf("2§C.F.G.S. ");break; + } + a=bioskey(0); + if(a==20480) subopcion1++; + if(a==18432) subopcion1--; + if(subopcion1==0) subopcion1=3; + if(subopcion1==4) subopcion1=1; + } + break; + } +//getch(); +textattr(LIGHTGRAY); +recuadro(20,6,73,20,1); +a=0; +switch(opcion) + { + case 1:recuadro(3,3,14,6,2); + while(a!=7181) + { + textattr(127); + gotoxy(4,4);cprintf("INTRODUCIR"); + gotoxy(4,5);cprintf("VISUALIZAR"); + textattr(LIGHTGRAY); + switch(subopcion2) + { + case 1: gotoxy(4,4);cprintf("INTRODUCIR");break; + case 2: gotoxy(4,5);cprintf("VISUALIZAR");break; + } + a=bioskey(0); + if(a==20480) subopcion2++; + if(a==18432) subopcion2--; + if(subopcion2==0) subopcion2=2; + if(subopcion2==3) subopcion2=1; + } + alumnos(subopcion,subopcion1,subopcion2); + textattr(LIGHTGRAY);recuadro(3,3,15,7,1); + break; + case 2:recuadro(11,3,33,6,2); + while(a!=7181) + { + textattr(127); + gotoxy(17,4);cprintf("EVALUACIONES"); + gotoxy(17,5);cprintf("FINAL DE E."); + textattr(LIGHTGRAY); + switch(subopcion2) + { + case 1: gotoxy(17,4);cprintf("EVALUACIONES");break; + case 2: gotoxy(17,5);cprintf("FINAL DE E.");break; + } + a=bioskey(0); + if(a==20480) subopcion2++; + if(a==18432) subopcion2--; + if(subopcion2==0) subopcion2=2; + if(subopcion2==3) subopcion2=1; + } + textattr(LIGHTGRAY);recuadro(11,3,34,7,1); + break; + } +} +//FUNCION PARA CREAR UN RECUADRO EN LAS COORDENADAS INDICADAS +void recuadro(int x,int y,int x1,int y1,int o) +{ +int a,b; +for(a=x;a!=x1+1;a++) + for(b=y;b!=y1+1;b++) + { + gotoxy(a,b); + if(o==0||o==2) cprintf("Û"); + else cprintf("²"); + } +if(o==2) + { + textattr(0); + for(a=y+1;a +#include +#include +#include +//declaracion de funciones +void inicio(); +void recuadro(int x,int y,int x1,int y1); +void principal(void); +char menu(char o); +char menu1(char peliculas[4][15],int sesiones[3],int salas[4]); +char menu2(char peliculas[4][15],int sesiones[3],int cliente[100][3], + int importe[50],int c[1]); +char menu3(int cliente[100][3],int importe[50],int c[1]); +void error(void); +void final(void); +//funcion principal +void main(void) +{ + clrscr(); + principal(); +} +//funcion que llama a todas las funciones +void principal() +{ +char o=' '; +char peliculas[4][15]={"0","0","0","0"}; +int sesiones[3]={0,0,0}; +int salas[4]={0,0,0,0}; +int cliente[100][3]; +int importe[50]; +int i,i1; +int c[1]={0}; + //inicializa cliente + for(i=0;i<3;i++) + for(i1=0;i1<100;i1++) + cliente[i1][i]=0; + //inicializa importe + for(i=0;i<50;i++) + importe[i]=0; + + inicio(); + while(o!='4') + { + o=menu(o); + switch(o) + { + case '1': + o=menu1(peliculas,sesiones,salas); + break; + case '2': + o=menu2(peliculas,sesiones,cliente,importe,c); + break; + case '3': + o=menu3(cliente,importe,c); + break; + case '4': + final(); + break; + default : + error(); + } + } +} +//funcion crea un recuadro en la coordenadas indicadas +void recuadro(int x,int y,int x1,int y1) +{ +int a,b; + for(a=x;a!=x1+1;a++) + for(b=y;b!=y1+1;b++) + { + gotoxy(a,b); + cprintf("Û"); + } +} +//funcion para el menu principal +char menu(char o) +{ + textbackground(0); + clrscr(); + textcolor(4); + recuadro(26,8,56,18); + textbackground(4); + textcolor(15); + gotoxy(28,10); + cprintf("1.-Peliculas en proyeccion"); + gotoxy(28,12); + cprintf("2.-Ventas"); + gotoxy(28,14); + cprintf("3.-Resultados"); + gotoxy(28,16); + cprintf("4.-Finalizar el programa"); + if(o==' ')o=getch(); + return o; +} +//menu primero +char menu1(char peliculas[4][15],int sesiones[3],int salas[4]) +{ +char o='0'; +int i,n; + textbackground(0); + textcolor(1); + recuadro(1,1,31,10); + textbackground(1); + textcolor(15); + gotoxy(2,2); + cprintf("1.-Dar de alta a 4 peliculas"); + gotoxy(2,4); + cprintf("2.-Modificar una pelicula"); + gotoxy(2,6); + cprintf("3.-Precios para las sesiones"); + gotoxy(2,8); + cprintf("4.-Capacidad de las salas"); + o=getch(); + switch(o) + { + //Dar de alta a 4 peliculas + case '1': + clrscr(); + for(i=0;i<4;i++) + { + gotoxy(30,12); + cprintf("Introduzca Pelicula %i¦:",i+1); + gotoxy(53,12); + gets(peliculas[i]); + gotoxy(53,12); + printf(" "); + } + break; + //modificar una pelicula + case '2': + clrscr(); + for(i=0;i<4;i++) + { + gotoxy(30,12+i); + cprintf("%i.-%s",i+1,peliculas[i]); + } + gotoxy(25,18); + cprintf("Introduzca pelicula a cambiar:"); + scanf("%d",&n); + //se pone getchar porque sino no sale + getchar(); + gotoxy(25,20); + cprintf("Introduzca nuevo nombre:"); + gets(peliculas[n-1]); + break; + //poner los precios de las 3 sesiones + case '3': + clrscr(); + for(i=0;i<3;i++) + { + gotoxy(30,12); + cprintf("Precios de Sesiones %i¦:",i+1); + gotoxy(53,12); + scanf("%d",&sesiones[i]); + gotoxy(53,12); + printf(" "); + } + break; + //capacidad de las 4 salas + case '4': + clrscr(); + for(i=0;i<4;i++) + { + gotoxy(30,12); + cprintf("Capacidad de sala %i¦:",i+1); + gotoxy(51,12); + scanf("%i",&salas[i]); + gotoxy(51,12); + printf(" "); + } + break; + default : + if(o!=' ') error(); + } +if(o==' ') return ' '; +else return '1'; +} +//menu segundo +char menu2(char peliculas[4][15],int sesiones[3],int cliente[100][3],int importe[50],int c[1]) +{ +int i,n; + textbackground(2); + textcolor(15); + + clrscr(); + printf("\t\t\t\tSELECCION DE PELICULA"); + for(i=0;i<4;i++) + { + gotoxy(39,12+i); + cprintf("%i.-%s",i+1,peliculas[i]); + } + gotoxy(34,22); + cprintf("Elija pelicula:"); + scanf("%i",&n); + cliente[c[1]][0]=n; + + clrscr(); + printf("\t\t\t\tSELECCION DE LA SESION"); + gotoxy(28,14);for(i=0;i<3;i++) + { + gotoxy(39,12+i); + cprintf("%i.-%d",i+1,sesiones[i]); + } + gotoxy(34,22); + cprintf("Elija sesion:"); + scanf("%i",&n); + cliente[c[1]][1]=n; + + clrscr(); + printf("\t\t\t\tSELECCION DE ENTRADAS"); + gotoxy(34,12); + cprintf("Numero de entradas:"); + scanf("%i",&n); + cliente[c[1]][2]=n; + + clrscr(); + //calculo del importe + importe[c[1]]=(cliente[c[1]][2])*(sesiones[cliente[c[1]][1]-1]); + gotoxy(34,12); + cprintf("IMPORTE TOTAL:%i",importe[c[1]]); + c[1]++; + getch(); +return ' '; +} +//menu tercero +char menu3(int cliente[100][3],int importe[50],int c[1]) +{ +char o='0'; +int i; +int suma[4]={0,0,0,0}; + + textbackground(0); + textcolor(3); + recuadro(49,14,80,24); + textbackground(3); + textcolor(15); + gotoxy(52,16); + cprintf("1.-Localidades por sala"); + gotoxy(52,19); + cprintf("2.-Importe total de ventas"); + gotoxy(52,22); + cprintf("3.-Localidades por sesion"); + o=getch(); + switch(o) + { + case '1': + clrscr(); + for(i=0;i34;x--) +{ +gotoxy(x,12); +cprintf("%s ",texto); +delay(25); +} +delay(1000); +for(y=13;y!=24;y++) +for(x=35;x<45;x=x+2) + { + gotoxy(x,y-1); + cprintf(" "); + gotoxy(x,y); + cprintf("%c",texto[x-35]); + gotoxy(x+1,25-y); + cprintf(" "); + gotoxy(x+1,24-y); + cprintf("%c",texto[x-34]); + delay(50); + } +} +//final del programa +void final() +{ +int x,y; +textbackground(0); +for(y=8;y<19;y++) + { + for(x=26;x<57;x++) + { + gotoxy(x,y); + cprintf(" "); + delay(10); + } + } +} diff --git a/CONCI b/CONCI new file mode 100644 index 0000000..7b71c6e --- /dev/null +++ b/CONCI @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/DAVID.CPP b/DAVID.CPP new file mode 100644 index 0000000..98a6031 --- /dev/null +++ b/DAVID.CPP @@ -0,0 +1,304 @@ +#include +#include +#include +#include +#include +#include + +#define k (2*3.14159/360) + +void muevel(int letras[29][56],char texto[1][9]); +void main() +{ +int gdriver=DETECT,gmode; +char texto[1][9]={"ES PRUEBA"}; +int letras[29][56]={ + //espacio en blanco + 0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0, + // la A + 0,0,0,1,1,0,0,0, + 0,0,1,1,1,1,0,0, + 0,1,1,0,0,1,1,0, + 0,1,1,0,0,1,1,0, + 0,1,1,1,1,1,1,0, + 0,1,1,0,0,1,1,0, + 0,1,1,0,0,1,1,0, + // la B + 1,1,1,1,1,1,0,0, + 0,1,1,0,0,1,1,0, + 0,1,1,0,0,1,1,0, + 0,1,1,1,1,1,0,0, + 0,1,1,0,0,1,1,0, + 0,1,1,0,0,1,1,0, + 1,1,1,1,1,1,0,0, + // la C + 0,0,1,1,1,1,0,0, + 0,1,1,0,0,1,1,0, + 1,1,0,0,0,0,0,0, + 1,1,0,0,0,0,0,0, + 1,1,0,0,0,0,0,0, + 0,1,1,0,0,1,1,0, + 0,0,1,1,1,1,0,0, + // la D + 1,1,1,1,1,0,0,0, + 0,1,1,0,1,1,0,0, + 0,1,1,0,0,1,1,0, + 0,1,1,0,0,1,1,0, + 0,1,1,0,0,1,1,0, + 0,1,1,0,1,1,0,0, + 1,1,1,1,1,0,0,0, + // la E + 1,1,1,1,1,1,1,0, + 0,1,1,0,0,0,1,0, + 0,1,1,0,1,0,0,0, + 0,1,1,1,1,0,0,0, + 0,1,1,0,1,0,0,0, + 0,1,1,0,0,0,1,0, + 1,1,1,1,1,1,1,0, + // la F + 1,1,1,1,1,1,1,0, + 0,1,1,0,0,0,1,0, + 0,1,1,0,1,0,0,0, + 0,1,1,1,1,0,0,0, + 0,1,1,0,1,0,0,0, + 0,1,1,0,0,0,0,0, + 1,1,1,1,0,0,0,0, + // la G + 0,0,1,1,1,1,0,0, + 0,1,1,0,0,1,1,0, + 1,1,0,0,0,0,0,0, + 1,1,0,0,0,0,0,0, + 1,1,0,0,1,1,1,0, + 1,1,0,0,0,1,1,0, + 0,1,1,1,1,1,1,0, + // la H + 0,1,1,0,0,1,1,0, + 0,1,1,0,0,1,1,0, + 0,1,1,0,0,1,1,0, + 0,1,1,1,1,1,1,0, + 0,1,1,0,0,1,1,0, + 0,1,1,0,0,1,1,0, + 0,1,1,0,0,1,1,0, + // la I + 0,1,1,1,1,1,1,0, + 0,0,0,1,1,0,0,0, + 0,0,0,1,1,0,0,0, + 0,0,0,1,1,0,0,0, + 0,0,0,1,1,0,0,0, + 0,0,0,1,1,0,0,0, + 0,1,1,1,1,1,1,0, + // la J + 0,0,0,1,1,1,1,0, + 0,0,0,0,1,1,0,0, + 0,0,0,0,1,1,0,0, + 0,0,0,0,1,1,0,0, + 1,1,0,0,1,1,0,0, + 1,1,0,0,1,1,0,0, + 0,1,1,1,1,0,0,0, + // la K + 1,1,1,0,0,1,1,0, + 0,1,1,0,0,1,1,0, + 0,1,1,0,1,1,0,0, + 0,1,1,1,1,0,0,0, + 0,1,1,0,1,1,0,0, + 0,1,1,0,0,1,1,0, + 1,1,1,0,0,1,1,0, + // la L + 1,1,1,1,0,0,0,0, + 0,1,1,0,0,0,0,0, + 0,1,1,0,0,0,0,0, + 0,1,1,0,0,0,0,0, + 0,1,1,0,0,0,1,0, + 0,1,1,0,0,1,1,0, + 1,1,1,1,1,1,1,0, + // la M + 1,1,0,0,0,1,1,0, + 1,1,1,0,1,1,1,0, + 1,1,1,1,1,1,1,0, + 1,1,1,1,1,1,1,0, + 1,1,0,1,0,1,1,0, + 1,1,0,0,0,1,1,0, + 1,1,0,0,0,1,1,0, + // la N + 1,1,0,0,0,1,1,0, + 1,1,1,0,0,1,1,0, + 1,1,1,1,0,1,1,0, + 1,1,0,1,1,1,1,0, + 1,1,0,0,1,1,1,0, + 1,1,0,0,0,1,1,0, + 1,1,0,0,0,1,1,0, + // la ¥ + 0,1,1,0,0,0,1,0, + 1,0,0,1,1,1,0,0, + 0,0,0,0,0,0,0,0, + 1,1,1,0,0,1,1,0, + 1,1,0,1,0,1,1,0, + 1,1,0,0,1,1,1,0, + 1,1,0,0,0,1,1,0, + // la O + 0,0,1,1,1,0,0,0, + 0,1,1,0,1,1,0,0, + 1,1,0,0,0,1,1,0, + 1,1,0,0,0,1,1,0, + 1,1,0,0,0,1,1,0, + 0,1,1,0,1,1,0,0, + 0,0,1,1,1,0,0,0, + // la P + 1,1,1,1,1,1,0,0, + 0,1,1,0,0,1,1,0, + 0,1,1,0,0,1,1,0, + 0,1,1,1,1,1,0,0, + 0,1,1,0,0,0,0,0, + 0,1,1,0,0,0,0,0, + 1,1,1,1,0,0,0,0, + // la Q + 0,0,1,1,1,0,0,0, + 0,1,1,0,1,1,0,0, + 1,1,0,0,0,1,1,0, + 1,1,0,0,0,1,1,0, + 1,1,0,1,1,0,1,0, + 1,1,0,0,1,1,0,0, + 0,1,1,1,0,1,1,0, + // la R + 1,1,1,1,1,1,0,0, + 0,1,1,0,0,1,1,0, + 0,1,1,0,0,1,1,0, + 0,1,1,1,1,1,0,0, + 0,1,1,0,1,1,0,0, + 0,1,1,0,0,1,1,0, + 1,1,1,1,0,1,1,0, + // la S + 0,0,1,1,1,1,0,0, + 0,1,1,0,0,1,1,0, + 0,1,1,0,0,0,0,0, + 0,0,1,1,1,1,0,0, + 0,0,0,0,0,1,1,0, + 0,1,1,0,0,1,1,0, + 0,0,1,1,1,1,0,0, + // la T + 0,1,1,1,1,1,1,0, + 0,1,0,1,1,0,1,0, + 0,0,0,1,1,0,0,0, + 0,0,0,1,1,0,0,0, + 0,0,0,1,1,0,0,0, + 0,0,0,1,1,0,0,0, + 0,0,1,1,1,1,0,0, + // la U + 0,1,1,0,0,1,1,0, + 0,1,1,0,0,1,1,0, + 0,1,1,0,0,1,1,0, + 0,1,1,0,0,1,1,0, + 0,1,1,0,0,1,1,0, + 0,1,1,0,0,1,1,0, + 0,0,1,1,1,1,0,0, + // la V + 0,1,1,0,0,1,1,0, + 0,1,1,0,0,1,1,0, + 0,1,1,0,0,1,1,0, + 0,1,1,0,0,1,1,0, + 0,1,1,0,0,1,1,0, + 0,0,1,1,1,1,0,0, + 0,0,0,1,1,0,0,0, + // la W + 1,1,0,0,0,1,1,0, + 1,1,0,0,0,1,1,0, + 1,1,0,0,0,1,1,0, + 1,1,0,1,0,1,1,0, + 1,1,1,1,1,1,1,0, + 1,1,1,0,1,1,1,0, + 1,1,0,0,0,1,1,0, + // la X + 1,1,0,0,0,1,1,0, + 0,1,1,0,1,1,0,0, + 0,0,1,1,1,0,0,0, + 0,0,1,1,1,0,0,0, + 0,1,1,0,1,1,0,0, + 1,1,0,0,0,1,1,0, + 1,1,0,0,0,1,1,0, + // la Y + 0,1,1,0,0,1,1,0, + 0,1,1,0,0,1,1,0, + 0,1,1,0,0,1,1,0, + 0,0,1,1,1,1,0,0, + 0,0,0,1,1,0,0,0, + 0,0,0,1,1,0,0,0, + 0,0,1,1,1,1,0,0, + // la Z + 1,1,1,1,1,1,1,0, + 1,1,0,0,0,1,1,0, + 0,0,0,0,1,1,0,0, + 0,0,0,1,1,0,0,0, + 0,0,1,1,0,0,1,0, + 0,1,1,0,0,1,1,0, + 1,1,1,1,1,1,1,0, + }; + +initgraph(&gdriver,&gmode,""); +muevel(letras,texto); +getch(); +closegraph(); +} + +//funcion que mueve letras +void muevel(int letras[29][56],char texto[1][9]) +{ + + // a para los 360 y para vertical y matriz + // x1 para posicion x + // y1 para posicion y + // v calcula seno + // i1 incrementa x1 + // c1 vuelve a posicionar + int x=0,y=0,c1=0/*longitud de palabra*/,c2=0,c3=0;//v + int finali=8,n[9],c=0,i=0; + //lee letras y las pone a numeros + for(x=0;x<9;x++) + { + if(toascii(texto[0][x]-65)<14) + n[x]=toascii(texto[0][x]-64); + else if(texto[0][x]=='¥') + n[x]=15; + else if(texto[0][x]==' ') + n[x]=0; + else + n[x]=toascii(texto[0][x]-63); + } + while(c2!=5) + { + //dibuja letras + for(y=0;y<70;y=y+10) + { + for(x=0;x<640;x=x+10) + { + if(letras[n[c3]][i]==1) setcolor(10); + else setcolor(5); + outtextxy(x,y,"*"); + if(x>=c1-1) i++; + if(i==finali) {i=finali-8;c3++;} + if(c3==8) c3=0; + } + c3=0; + c=c+8; + i=c; + finali=c+8; + } + //matriz i + finali=7; + //linea + i=0; + //cada linea + c=0; + //rota paleta + getch(); + c1=c1+10; + if(c1==640/*+630+longitud de palabra*/) {c1=0;c2++;} + + } +} + diff --git a/DAVID.EXE b/DAVID.EXE new file mode 100644 index 0000000..a86c16a Binary files /dev/null and b/DAVID.EXE differ diff --git a/DEMO/DAC.PCX b/DEMO/DAC.PCX new file mode 100644 index 0000000..45931a8 Binary files /dev/null and b/DEMO/DAC.PCX differ diff --git a/DEMO/DEMO.CPP b/DEMO/DEMO.CPP new file mode 100644 index 0000000..21c94c7 --- /dev/null +++ b/DEMO/DEMO.CPP @@ -0,0 +1,897 @@ +//Bibliotecas +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +//variables constantes +#define RES_X 640 +#define RES_Y 480 +#define ERROR 1 +#define OK 1 +#define k (2*3.14159/360) +#define RADIO 255 +#define SALTOS_PROFUNDOS 8 +#define SALTOS_ANCHOS 7 +#define BLOQUEO_RADIO 1 +#define INCREMENTAL 1 +#define PROFUNDIDAD_TUNEL 35 +#define FACTOR_SERPIENTE 0.015F +//estructuras y tipos +typedef struct +{ + unsigned char R, G, B; + +} ColorValue; +typedef ColorValue VGAPaletteType[256]; +VGAPaletteType Pal; +extern int far _Cdecl Svga256_fdriver[]; +//funciones +int MuestraImagen( char *file ); +int CargaPaleta(char *file); +void InicializaSVGA(void); +void InicializaSVGA(void); +void RellenaTablas(void); +void Put( int x, int y, char c); +void Circulo( int x, int y, int radio, int giro, int Color ); +void CirculoB( int x, int y, int radio, int giro ); +void TunelEstrellas(void); +void ReadPal( VGAPaletteType K ); +void WritePal( VGAPaletteType K ); +void CreaPaleta(void); +void letrasm(char texto[100]); +void demo1(void); +void demo2(void); +void demo3(void); +void demo4(void); +void demo5(void); +void demo6(void); +//variables externas +int huge DetectVGA256(){ return 2; } +int MuestraImagen( char *file ); +int CargaPaleta(char *file ); +int PERFECCION_CIRCULO = 8; +int qeu = 0; +int Incremento = -1, contador = 0; +int XSinMov[256], YSinMov[256]; +int TSin[360+90]; +int letras[29][56]={ + //espacio en blanco + 0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0, + // la A + 0,0,0,1,1,0,0,0, + 0,0,1,1,1,1,0,0, + 0,1,1,0,0,1,1,0, + 0,1,1,0,0,1,1,0, + 0,1,1,1,1,1,1,0, + 0,1,1,0,0,1,1,0, + 0,1,1,0,0,1,1,0, + // la B + 1,1,1,1,1,1,0,0, + 0,1,1,0,0,1,1,0, + 0,1,1,0,0,1,1,0, + 0,1,1,1,1,1,0,0, + 0,1,1,0,0,1,1,0, + 0,1,1,0,0,1,1,0, + 1,1,1,1,1,1,0,0, + // la C + 0,0,1,1,1,1,0,0, + 0,1,1,0,0,1,1,0, + 1,1,0,0,0,0,0,0, + 1,1,0,0,0,0,0,0, + 1,1,0,0,0,0,0,0, + 0,1,1,0,0,1,1,0, + 0,0,1,1,1,1,0,0, + // la D + 1,1,1,1,1,0,0,0, + 0,1,1,0,1,1,0,0, + 0,1,1,0,0,1,1,0, + 0,1,1,0,0,1,1,0, + 0,1,1,0,0,1,1,0, + 0,1,1,0,1,1,0,0, + 1,1,1,1,1,0,0,0, + // la E + 1,1,1,1,1,1,1,0, + 0,1,1,0,0,0,1,0, + 0,1,1,0,1,0,0,0, + 0,1,1,1,1,0,0,0, + 0,1,1,0,1,0,0,0, + 0,1,1,0,0,0,1,0, + 1,1,1,1,1,1,1,0, + // la F + 1,1,1,1,1,1,1,0, + 0,1,1,0,0,0,1,0, + 0,1,1,0,1,0,0,0, + 0,1,1,1,1,0,0,0, + 0,1,1,0,1,0,0,0, + 0,1,1,0,0,0,0,0, + 1,1,1,1,0,0,0,0, + // la G + 0,0,1,1,1,1,0,0, + 0,1,1,0,0,1,1,0, + 1,1,0,0,0,0,0,0, + 1,1,0,0,0,0,0,0, + 1,1,0,0,1,1,1,0, + 1,1,0,0,0,1,1,0, + 0,1,1,1,1,1,1,0, + // la H + 0,1,1,0,0,1,1,0, + 0,1,1,0,0,1,1,0, + 0,1,1,0,0,1,1,0, + 0,1,1,1,1,1,1,0, + 0,1,1,0,0,1,1,0, + 0,1,1,0,0,1,1,0, + 0,1,1,0,0,1,1,0, + // la I + 0,1,1,1,1,1,1,0, + 0,0,0,1,1,0,0,0, + 0,0,0,1,1,0,0,0, + 0,0,0,1,1,0,0,0, + 0,0,0,1,1,0,0,0, + 0,0,0,1,1,0,0,0, + 0,1,1,1,1,1,1,0, + // la J + 0,0,0,1,1,1,1,0, + 0,0,0,0,1,1,0,0, + 0,0,0,0,1,1,0,0, + 0,0,0,0,1,1,0,0, + 1,1,0,0,1,1,0,0, + 1,1,0,0,1,1,0,0, + 0,1,1,1,1,0,0,0, + // la K + 1,1,1,0,0,1,1,0, + 0,1,1,0,0,1,1,0, + 0,1,1,0,1,1,0,0, + 0,1,1,1,1,0,0,0, + 0,1,1,0,1,1,0,0, + 0,1,1,0,0,1,1,0, + 1,1,1,0,0,1,1,0, + // la L + 1,1,1,1,0,0,0,0, + 0,1,1,0,0,0,0,0, + 0,1,1,0,0,0,0,0, + 0,1,1,0,0,0,0,0, + 0,1,1,0,0,0,1,0, + 0,1,1,0,0,1,1,0, + 1,1,1,1,1,1,1,0, + // la M + 1,1,0,0,0,1,1,0, + 1,1,1,0,1,1,1,0, + 1,1,1,1,1,1,1,0, + 1,1,1,1,1,1,1,0, + 1,1,0,1,0,1,1,0, + 1,1,0,0,0,1,1,0, + 1,1,0,0,0,1,1,0, + // la N + 1,1,0,0,0,1,1,0, + 1,1,1,0,0,1,1,0, + 1,1,1,1,0,1,1,0, + 1,1,0,1,1,1,1,0, + 1,1,0,0,1,1,1,0, + 1,1,0,0,0,1,1,0, + 1,1,0,0,0,1,1,0, + // la ¥ + 0,1,1,0,0,0,1,0, + 1,0,0,1,1,1,0,0, + 0,0,0,0,0,0,0,0, + 1,1,1,0,0,1,1,0, + 1,1,0,1,0,1,1,0, + 1,1,0,0,1,1,1,0, + 1,1,0,0,0,1,1,0, + // la O + 0,0,1,1,1,0,0,0, + 0,1,1,0,1,1,0,0, + 1,1,0,0,0,1,1,0, + 1,1,0,0,0,1,1,0, + 1,1,0,0,0,1,1,0, + 0,1,1,0,1,1,0,0, + 0,0,1,1,1,0,0,0, + // la P + 1,1,1,1,1,1,0,0, + 0,1,1,0,0,1,1,0, + 0,1,1,0,0,1,1,0, + 0,1,1,1,1,1,0,0, + 0,1,1,0,0,0,0,0, + 0,1,1,0,0,0,0,0, + 1,1,1,1,0,0,0,0, + // la Q + 0,0,1,1,1,0,0,0, + 0,1,1,0,1,1,0,0, + 1,1,0,0,0,1,1,0, + 1,1,0,0,0,1,1,0, + 1,1,0,1,1,0,1,0, + 1,1,0,0,1,1,0,0, + 0,1,1,1,0,1,1,0, + // la R + 1,1,1,1,1,1,0,0, + 0,1,1,0,0,1,1,0, + 0,1,1,0,0,1,1,0, + 0,1,1,1,1,1,0,0, + 0,1,1,0,1,1,0,0, + 0,1,1,0,0,1,1,0, + 1,1,1,1,0,1,1,0, + // la S + 0,0,1,1,1,1,0,0, + 0,1,1,0,0,1,1,0, + 0,1,1,0,0,0,0,0, + 0,0,1,1,1,1,0,0, + 0,0,0,0,0,1,1,0, + 0,1,1,0,0,1,1,0, + 0,0,1,1,1,1,0,0, + // la T + 0,1,1,1,1,1,1,0, + 0,1,0,1,1,0,1,0, + 0,0,0,1,1,0,0,0, + 0,0,0,1,1,0,0,0, + 0,0,0,1,1,0,0,0, + 0,0,0,1,1,0,0,0, + 0,0,1,1,1,1,0,0, + // la U + 0,1,1,0,0,1,1,0, + 0,1,1,0,0,1,1,0, + 0,1,1,0,0,1,1,0, + 0,1,1,0,0,1,1,0, + 0,1,1,0,0,1,1,0, + 0,1,1,0,0,1,1,0, + 0,0,1,1,1,1,0,0, + // la V + 0,1,1,0,0,1,1,0, + 0,1,1,0,0,1,1,0, + 0,1,1,0,0,1,1,0, + 0,1,1,0,0,1,1,0, + 0,1,1,0,0,1,1,0, + 0,0,1,1,1,1,0,0, + 0,0,0,1,1,0,0,0, + // la W + 1,1,0,0,0,1,1,0, + 1,1,0,0,0,1,1,0, + 1,1,0,0,0,1,1,0, + 1,1,0,1,0,1,1,0, + 1,1,1,1,1,1,1,0, + 1,1,1,0,1,1,1,0, + 1,1,0,0,0,1,1,0, + // la X + 1,1,0,0,0,1,1,0, + 0,1,1,0,1,1,0,0, + 0,0,1,1,1,0,0,0, + 0,0,1,1,1,0,0,0, + 0,1,1,0,1,1,0,0, + 1,1,0,0,0,1,1,0, + 1,1,0,0,0,1,1,0, + // la Y + 0,1,1,0,0,1,1,0, + 0,1,1,0,0,1,1,0, + 0,1,1,0,0,1,1,0, + 0,0,1,1,1,1,0,0, + 0,0,0,1,1,0,0,0, + 0,0,0,1,1,0,0,0, + 0,0,1,1,1,1,0,0, + // la Z + 0,1,1,1,1,1,1,0, + 1,0,0,0,0,0,0,1, + 1,0,1,0,0,1,0,1, + 1,0,0,0,0,0,0,1, + 1,0,1,1,1,1,0,1, + 1,1,0,0,0,0,1,1, + 0,1,1,1,1,1,1,0, + }; + +//Funcion principal +void main() +{ +int gdriver=DETECT,gmode; +initgraph(&gdriver,&gmode,"c:\\program\\borlandc\\bgi"); +clearviewport(); +demo1(); +letrasm(" GRAFICOS IMPRESIONANTEMENTE CUTRES PA LLORA"); +demo2(); +letrasm(" HAY VA UNA CAIDITA DE LINEAS ASEXUALES"); +demo3(); +letrasm(" VAMO A DADLE A LAS IMAGENES"); +demo4(); +letrasm(" Y QUE TAL UN TUNEL INCREIBLEBLE"); +demo5(); +demo6(); + +} +//DEMO1 +void demo1() +{ +char texto1[100]={"OGA MUESTRA"}; +int V; +int a=0,ac1,color; +int i=0; +int n[100],l; +int c=48,c1=0,x=0,y=250; +delay(500); +//Flan +l=strlen(texto1); +for(a=0;a170&&!kbhit()) + { + while(a0; contador--) + { + putpixel (ancho, alto, byte); + ancho++; + } + } + } + } + fclose(fp); + + } else return ERROR; + + + + return OK; +} +int CargaPaleta(char *file) +{ + int index; + FILE *fp; + + if ( (fp=fopen( file, "rb" ) ) == NULL ) + return ERROR; + + + if ( fseek( fp, -768L, SEEK_END ) == 0 ) + { + for (index=0; index<256; index++) + { + // get the red component + // get the green component + // get the blue component + // set components + setrgbpalette( index, (getc(fp) >> 2), (getc(fp) >> 2), (getc(fp) >> 2) ); + } // end for index + + } + + fclose( fp ); + return OK; +} + + +void InicializaSVGA(void) { + + int Gd = DETECT, Gm; + int Drv, errorcode; + + installuserdriver("Svga256",DetectVGA256); +// registerfarbgidriver(Svga256_fdriver); + + initgraph(&Gd,&Gm,"c:\\program\\borlandc\\bgi"); + + /* read result of initialization */ + errorcode = graphresult(); + +if (errorcode != grOk) /* an error occurred */ +{ + cprintf("Graphics error: %s\n", grapherrormsg(errorcode)); + cprintf("Presione una tecla para finalizar:"); + getch(); + exit(1); /* return with error code */ +} + +} + +//DEMO5 +void demo5() +{ +int ok=0; +RellenaTablas(); + // Cambiamos a modo grafico + asm mov ax, 0x13 + asm int 0x10 + // ¨ Porque no mejoramos la paleta 16x2 ? + CreaPaleta(); + ReadPal(Pal); +{ + auto int I, J; +/* // (* Use this if you want to view the palette *) + for( I=0; I<255; I++ ) + { + for( J=0; J<20; J++ ) + Put(I,J,I); + } + getch(); +*/ +} + + while( kbhit() ) getch(); + ok = 0; + //TUNEL + while(ok<4000&&!kbhit()) + { + TunelEstrellas(); + ok++; + } +// PERFECCION_CIRCULO = 360; + /*while( !ok ) + { + if ( kbhit() ) + switch( getch() ) + { + case 13: + qeu = !qeu; + Pal[0].R = qeu ? 255:0; + Pal[0].G = qeu ? 255:0; + Pal[0].B = qeu ? 255:0; + WritePal(Pal); + break; + case 32: + getch(); + break; + case 27: + ok = 1; + break; + case '+': + PERFECCION_CIRCULO++; + _fmemset( MK_FP( 0xA000, 0 ), 0, 320*200 ); + break; + case '-': + PERFECCION_CIRCULO--; + if ( PERFECCION_CIRCULO < 1 ) PERFECCION_CIRCULO = 1; + _fmemset( MK_FP( 0xA000, 0 ), 0, 320*200 ); + break; + } + */ + + //} + + // Cambiamos a modo texto + asm mov ax, 3 + asm int 0x10 + +} +//Funcion de DEMO5 +void RellenaTablas(void) +{ + float angle; + + angle = 0; + while( angle < 256 ) + { + XSinMov[angle] = YSinMov[angle] = (int)( sin( (2*M_PI*angle*1.4)/360 ) * 360) / (2*M_PI); + YSinMov[angle] = 0; + angle+=1; + }; + + angle = 0; + while( angle < (360+90) ) + { + TSin[angle] = (int)(sin( (2*M_PI*angle)/360 ) * 360 / (2*M_PI) ); + angle+=1; + }; + +} +//Funcion de DEMO5 +void Put( int x, int y, char c) +{ + if ( x < 0 || x >= 320 ) return; + if ( y < 0 || y >= 200 ) return; + + // { Written by Matt Sottile } + asm mov ax,y + asm mov bx,ax + asm shl ax,8 + asm shl bx,6 + asm add bx,ax + asm add bx,x + asm mov ax,0xa000 + asm mov es,ax + asm mov al,c + asm mov es:[bx],al +}; +//Funcion de DEMO5 +// Circulo con impresi¢n de giro ( MEJORA POR JD ) +void Circulo( int x, int y, int radio, int giro, int Color ) +{ + int angle; + + for ( angle = 0; angle < 360; angle+=PERFECCION_CIRCULO ) + Put( x + (radio*FACTOR_SERPIENTE*TSin[ (giro + angle)%360 + 90 ]), y + (radio*FACTOR_SERPIENTE*TSin[ (giro+angle)%360 ]), angle >= 0 && angle <= 50 ? (Color-PROFUNDIDAD_TUNEL) : Color ); + +}; +//Funcion de DEMO5 +// Circulo con impresi¢n de giro ( MEJORA POR JD ) +void CirculoB( int x, int y, int radio, int giro ) +{ + int angle; + + for ( angle = 0; angle < 360; angle+=PERFECCION_CIRCULO ) + Put( x + (radio*FACTOR_SERPIENTE*TSin[ (giro + angle)%360 + 90 ]), y + (radio*FACTOR_SERPIENTE*TSin[ (giro+angle)%360 ]), 0 ); +}; +//Funcion de DEMO5 +void TunelEstrellas(void) +{ + int depth, Color; + static unsigned char ZMov = 0; + static int GiroAngular = 0; + unsigned char Movimiento = ZMov; + static Subidon = 255; + + static Velocidad = 0; + // Controles de giro por JD: + // SUAVE ZMov + // DURO Movimiento + int OGiroAngular = GiroAngular = 60; +// GiroAngular = ( GiroAngular++ ) % 360; + + + + ZMov ++; + Movimiento = ZMov; + Color = 255-PROFUNDIDAD_TUNEL; +// Color = 255; + Velocidad++; + if ( Velocidad == 5 ) + { + Velocidad = 0; + // Subidon --; if ( Subidon < 255-PROFUNDIDAD_TUNEL ) Subidon = 255; + Subidon = (Subidon++)%PROFUNDIDAD_TUNEL; + } + + for ( depth=0; depth=0; depth-=SALTOS_ANCHOS*INCREMENTAL, Movimiento+=SALTOS_PROFUNDOS, Color-- ) + { +/* +OGiroAngular = GiroAngular; +GiroAngular = ( GiroAngular++ ) % 360; +*/ + + // Borra el anterior + CirculoB( XSinMov[(unsigned char)(Movimiento-1)] + 160, YSinMov[(unsigned char)(Movimiento-1)] + 100, RADIO - depth*BLOQUEO_RADIO, OGiroAngular + 0*Movimiento ); + + Subidon = (Subidon++)%PROFUNDIDAD_TUNEL; + + // Dibuja el nuevo circulo +// Circulo( XSinMov[Movimiento] + 160, YSinMov[Movimiento] + 100, RADIO - depth*BLOQUEO_RADIO, GiroAngular + 0*Movimiento, (Subidon >= Color && Subidon <= Color + 2 ) ? 1: Color ); + Circulo( XSinMov[Movimiento] + 160, YSinMov[Movimiento] + 100, RADIO - depth*BLOQUEO_RADIO, GiroAngular + 0*Movimiento, Subidon%6 == 0 || Subidon%6 == 1 ? 1+Subidon : Color); + } + +// delay(10); +} +//Funcion de DEMO5 +void ReadPal( VGAPaletteType K ) +{ + struct REGPACK outR; + + outR.r_ax = 0x1017; + outR.r_bx = 0; + outR.r_cx = 256; + outR.r_es = FP_SEG(K); + outR.r_dx = FP_OFF(K); + while( ( inport(0x03DA) & 0x08 ) == 0x08 ); // {Wait for rescan} + intr( 0x10, &outR ); +}; +//Funcion de DEMO5 +void WritePal( VGAPaletteType K ) +{ + struct REGPACK outR; + + outR.r_ax = 0x1012; + outR.r_bx = 0; + outR.r_cx = 256; + outR.r_es = FP_SEG(K); + outR.r_dx = FP_OFF(K); + while( ( inport(0x03DA) & 0x08 ) == 0x08 ); // {Wait for rescan} + intr( 0x10, &outR ); +}; +//Funcion de DEMO5 +void CreaPaleta(void) +{ + unsigned char I; + + memset( Pal, 0, sizeof(Pal) ); + + Pal[1].R = 255; + Pal[1].G = 255; + Pal[1].B = 255; + + Pal[255].R = 20; + Pal[255].G = 0; + Pal[255].B = 0; + for ( I=254/*MaxColor*/; I > 254-PROFUNDIDAD_TUNEL; I-- ) + { + Pal[I] = Pal[I+1]; + { + if ( Pal[I].R<63 ) Pal[I].R++; + if ( Pal[I].R<63 ) Pal[I].R++; + if ( (I % 2==0) && (Pal[I].G<53) ) Pal[I].G++; + if ( (I % 2==0) && (Pal[I].B<63) ) Pal[I].B++; + } + } + +#ifdef TODO_GRIS + Pal[5].R = 255; + Pal[5].G = 255; + Pal[5].B = 255; + for ( I=5; I < 255; I++ ) + { + Pal[I] = Pal[I-1]; + { + Pal[I].R--; + Pal[I].G--; + Pal[I].B--; + } + } +#endif + + Pal[255-PROFUNDIDAD_TUNEL+1].R = 0; + Pal[255-PROFUNDIDAD_TUNEL+1].G = 0; + Pal[255-PROFUNDIDAD_TUNEL+1].B = 20; + for ( I=/*MaxColor*/255-PROFUNDIDAD_TUNEL; I > 255-2*PROFUNDIDAD_TUNEL; I-- ) + { + Pal[I] = Pal[I+1]; + { + if ( Pal[I].B<63 ) Pal[I].B++; + if ( Pal[I].B<63 ) Pal[I].B++; + if ( (I % 2==0) && (Pal[I].G<53) ) Pal[I].G++; + if ( (I % 2==0) && (Pal[I].R<63) ) Pal[I].R++; + } + } + + +#ifdef TODO_BLANCO + memset( Pal, 255, sizeof(Pal) ); + Pal[0].R = 0; + Pal[0].G = 0; + Pal[0].B = 0; +#endif + + WritePal(Pal); +} +//DEMO6 +void demo6() +{ +int y; +int gdriver=DETECT,gmode; +char texto[5][100]={"Programador:Oscar","Musica:NO HAY", + "Agradecimientos a:","Jose David(el tunel es de el)", + "PROMETO MEJORAR"}; + +initgraph(&gdriver,&gmode,"c:\\program\\borlandc\\bgi"); +clearviewport(); +for(y=440;y>-70;y--) +{ +setcolor(15); +if(y>1) outtextxy(230,y,texto[0]); +if(y>-20&&y<430) outtextxy(230,y+20,texto[1]); +if(y>-40&&y<420) outtextxy(230,y+40,texto[2]); +if(y>-60&&y<410) outtextxy(230,y+60,texto[3]); +delay(20); +setcolor(0); +if(y>1) outtextxy(230,y,texto[0]); +if(y>-20&&y<430) outtextxy(230,y+20,texto[1]); +if(y>-40&&y<420) outtextxy(230,y+40,texto[2]); +if(y>-60&&y<410) outtextxy(230,y+60,texto[3]); +} +clearviewport(); +letrasm(" QUIERO LA REVANCHAAAAAA ZZZZZ "); +closegraph(); +} +//LETRAS +void letrasm(char texto[100]) +{ +//Letras moviendose +int V; +int finali=8,i=0,c3=0; +int r=0,i1=0,ac3=0,c4=0; +int n[100],l; +int c=0,c1=640,x=0,y=0; +int a=0,ac1=c1,color; +randomize(); +color=rand()%14+1; +l=strlen(texto); + for(a=0;a=c1||c1<0) {i++;} + if(i==finali) {i=finali-8;c3++;} + x=x+10; + if(x==640) + { + c1=ac1;x=0;y=y+10;c3=ac3;c=c+8;i=c+i1;finali=c+8;} + } + + x=0;y=0; + finali=8; + i=0; + c=0; + delay(10); + c1=c1-10; + ac1=c1; + if(c1<0) + { + i1=0; + if(c1>-640) + r=10; + else + r=abs(c1)-640; + while(y +#include +#include +#include +#include +#include + + +//inicio del main +int main(void) +{ +int gdriver=DETECT,gmode,errorcode; +//inicio de graficos +initgraph(&gdriver,&gmode,""); +errorcode=graphresult(); + if(errorcode!=grOk) + { + printf("error de graficos: %s\n",grapherrormsg(errorcode)); + printf("presione una tecla"); + getch(); + exit(1); + } +//inicio del programa +int b=10,p=0,i,j,cont=0,a=0,x; +char c; +while(cont<500&&(c!='q')) +{ +clearviewport(); +for(i=0;i<360;i++) +{ + line(320+p*cos(b*i),200+p*sin(b*i),320+p*cos(b*(i+1)),200+p*sin(b*(i+1))); + a++; + if (a==4) + { + a=0; + p=p+4; + } +delay(25); + } +//nuevos valores para variables +x=(rand() %15)+1; +if(x!=5) setcolor(x); +delay(500); +b=b+1; +p=0; +cont++; +c=getch(); +} +//cierra graficos +getch(); +closegraph(); +return 0; +} + + + + diff --git a/DIBUJO.EXE b/DIBUJO.EXE new file mode 100644 index 0000000..b1ba309 Binary files /dev/null and b/DIBUJO.EXE differ diff --git a/EGAVGA.BGI b/EGAVGA.BGI new file mode 100644 index 0000000..8001631 Binary files /dev/null and b/EGAVGA.BGI differ diff --git a/ESO3A.DAT b/ESO3A.DAT new file mode 100644 index 0000000..e69de29 diff --git a/ESO3B.DAT b/ESO3B.DAT new file mode 100644 index 0000000..e69de29 diff --git a/ESO4A.DAT b/ESO4A.DAT new file mode 100644 index 0000000..e69de29 diff --git a/ESO4B.DAT b/ESO4B.DAT new file mode 100644 index 0000000..e69de29 diff --git a/INDICEAG.DAT b/INDICEAG.DAT new file mode 100644 index 0000000..c3a783c Binary files /dev/null and b/INDICEAG.DAT differ diff --git a/INSTALAR.CPP b/INSTALAR.CPP new file mode 100644 index 0000000..a769877 --- /dev/null +++ b/INSTALAR.CPP @@ -0,0 +1,90 @@ +//programa de instalacion del software +#include +#include +#include +//declaracion de funciones +void recuadro(void); +char menu(void); +void datos(char compa[1][40],char usu[1][40]); +void peloteo(char usu[1][40]); +//funcion principal +void main(void) +{ +char opcion; +char compa[1][40]; +char usu[1][40]; +clrscr(); +textcolor(3); +recuadro(); +opcion=menu(); +if(opcion=='1') +{ +datos(compa,usu); +peloteo(usu); +system("copy a:\\programa\\programa.exe c:\\programa.exe"); +gotoxy(30,24); +printf("PROGRAMA INSTALADO"); +} +clrscr(); +} + +//funcion crea un recuadro alrededor de la pantalla de texto de 80X24 +void recuadro() +{ +int x,y=1; +for(y=1;y<24;y++) +for(x=1;x<81;x++) + { + if(y==1||y==23) + { + gotoxy(x,y); + cprintf("Û"); + } + else + { + gotoxy(1,y); + cprintf("Û"); + gotoxy(80,y); + cprintf("Û"); + } + } +} + +//presenta opciones y devuelve la opcion elegida +char menu() +{ +char op; +textcolor(10); +gotoxy(32,10); +cprintf("1.- INSTALAR PROGRAMA"); +gotoxy(32,15); +cprintf("2.- SALIR AL DOS"); +while(op!='1'&&op!='2') +{ +op=getch(); +} +return op; +} + +//funcion para nombre de la compa¤ia y usuario +void datos(char compa[1][40],char usu[1][40]) +{ +clrscr(); +textcolor(6); +recuadro(); +gotoxy(20,10); +cprintf("INTRODUZCA NOMBRE DE LA COMPA¥IA:"); +gets(compa[0]); +gotoxy(20,15); +cprintf("INTRODUZCA NOMBRE DE USUARIO:"); +gets(usu[0]); +} +//muestra mensaje antes de instalar el programa +void peloteo(char usu[1][40]) +{ +clrscr(); +gotoxy(27,10); +printf("ESPERE UN MOMENTO SE¥OR:%s",usu[0]); +gotoxy(30,15); +printf("PROGRAMA INSTALANDOSE"); +} diff --git a/INSTALAR.EXE b/INSTALAR.EXE new file mode 100644 index 0000000..c9c3f1a Binary files /dev/null and b/INSTALAR.EXE differ diff --git a/JUEGO.CPP b/JUEGO.CPP new file mode 100644 index 0000000..132af18 --- /dev/null +++ b/JUEGO.CPP @@ -0,0 +1,279 @@ +//juegos de roll a viernes 13 de diciembre de 1996 +#include +#include +#include +#include +#include + +void presentacion(); +int arbol1(); +int arbol2(); +int arbol3(); +int arbol4(); +int arbol5(); +int arbol6(); +int arbol7(); +int arbol8(); +int arbol9(); +int arbol10(); +int arbol11(); +int arbol12(); +int arbol13(); +int arbol14(); +int arbol15(); +int arbol16(); +int arbol17(); +int arbol18(); +int arbol19(); +int arbol20(); +int arbol21(); +int arbol22(); +int arbol23(); +int arbol24(); +int arbol25(); +int arbol26(); +int arbol27(); +int arbol28(); +void fin(); + + + + + + + + + + + + + + + + + +void InicializaGraficos(void) +{ + int gdriver=DETECT,gmode,errorcode; + initgraph(&gdriver,&gmode,""); + errorcode=graphresult(); + if(errorcode!=grOk) + { + printf("error de graficos: %s\n",grapherrormsg(errorcode)); + printf("presione una tecla"); + exit(1); + } +}; + + +int main() +{ +char a; + + //comienzo del main + presentacion(); + getch(); + + //inicializacion de graficos + InicializaGraficos(); + +exit = 0; +ACCION = FuncionQueMuestraCOMENTARIOS( EdJ ); +do{ + switch( Estado_Del_Juego ) + { + case 1: + op1 -> EdJ = 2; else op2 ->3 + 2 + + 3 + op1 -> EdJ = 1 + 4 + 5 + 6 + 7 + } + ACCION = FuncionQueMuestraCOMENTARIOS( EdJ ); + +}while( !exit ); + + +//aventura +a=arbol1(); +if(a=='1') arbol2(); +else fin(); +if(a=='1') arbol3(); +else fin(); +if(a=='1') arbol4(); +else fin(); +if(a=='1') arbol5(); +else fin(); +if(a=='1') arbol6(); +else fin(); +if(a=='1') arbol7(); +else fin(); +if(a=='1') arbol8(); +else fin(); +if(a=='1') arbol9(); +else fin(); +if(a=='1') arbol10(); +else fin(); +if(a=='1') arbol11(); +else fin(); +if(a=='1') arbol12(); +else fin(); +if(a=='1') arbol13(); +else fin(); +if(a=='1') arbol14(); +else fin(); +if(a=='1') arbol15(); +else fin(); +if(a=='1') arbol16(); +else fin(); +if(a=='1') arbol17(); +else fin(); +if(a=='1') arbol18(); +else fin(); +if(a=='1') arbol19(); +else fin(); + +//cierre de graficos +getch(); +closegraph(); +return 0; +} + +void presentacion() +{ //presentacion + char nombre[1][6]={"OSCAR"}; + char nombre1[1][10]={"PRESENTA:"}; + int a=5,b=1,c=42,turno=0; + + clrscr(); + textbackground(0); + + textcolor(4); + while(a>0) + { + a--; + while(b +#include +#include + +void main() +{ +int matriz[12][12]; +int i,j,x,y,c=0,c1=0,fin=0; + + clrscr(); + textcolor(5); + //inicializacion de variables + + for(i=0;i<12;i++) + { + for(j=0;j<12;j++) + { + matriz[i][j]=0; + } + } + + + + //introduccion de minas al azar + + randomize(); + i=0; + while(i<10) + { + x=(rand() %9)+1; + y=(rand() %9)+1; + if(matriz[x][y]!=1) + { + matriz[x][y]=1; + i++; + } + } + + + + + //muestra matriz + + for(i=4;i<24;i=i+2) + { + for(j=4;j<24;j=j+2) + { + gotoxy(abs(j/2)*2,abs(i/2)); + cprintf("*"); + } + } + + + + + // pone coordenada + + gotoxy(1,1); + cprintf("b a1 2 3 4 5 6 7 8 9 10"); + for(i=1;i<11;i++) + { + gotoxy(1,i+1); + cprintf("%d",i); + } + + + + + + // introduce coordenada + + gotoxy(1,20); + printf("introduzca coordenada[a,b]:"); + while((c1<90)&&(fin==0)) + { + x=0;y=0; + while(((x<1)||(x>10))||((y<1)||(y>10))) + { + gotoxy(28,20); + scanf("%d,%d",&x,&y); + gotoxy(28,20); + printf(" "); + } + + + //comprueba si ya existe + if(matriz[x][y]==2) + { + gotoxy(1,22); + printf("coordenada ya introducida(pulse una tecla)"); + getch(); + gotoxy(1,22); + printf(" "); + } + else if(matriz[x][y]!=1) c1++; + + //comprueba las minas de alrededor + + if(matriz[x][y]==1) fin=1; + else matriz[x][y]=2; + + for(i=x-1;i +#include +#include +#include +#include +#include +#include +#define k (2*3.14159/360) +char texto/*[1]*/[100]={" ESTO ES UNA PRUEBA DEL TAMA¥O DE CADENA "}; +int letras[29][56]={ + //espacio en blanco + 0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0, + // la A + 0,0,0,1,1,0,0,0, + 0,0,1,1,1,1,0,0, + 0,1,1,0,0,1,1,0, + 0,1,1,0,0,1,1,0, + 0,1,1,1,1,1,1,0, + 0,1,1,0,0,1,1,0, + 0,1,1,0,0,1,1,0, + // la B + 1,1,1,1,1,1,0,0, + 0,1,1,0,0,1,1,0, + 0,1,1,0,0,1,1,0, + 0,1,1,1,1,1,0,0, + 0,1,1,0,0,1,1,0, + 0,1,1,0,0,1,1,0, + 1,1,1,1,1,1,0,0, + // la C + 0,0,1,1,1,1,0,0, + 0,1,1,0,0,1,1,0, + 1,1,0,0,0,0,0,0, + 1,1,0,0,0,0,0,0, + 1,1,0,0,0,0,0,0, + 0,1,1,0,0,1,1,0, + 0,0,1,1,1,1,0,0, + // la D + 1,1,1,1,1,0,0,0, + 0,1,1,0,1,1,0,0, + 0,1,1,0,0,1,1,0, + 0,1,1,0,0,1,1,0, + 0,1,1,0,0,1,1,0, + 0,1,1,0,1,1,0,0, + 1,1,1,1,1,0,0,0, + // la E + 1,1,1,1,1,1,1,0, + 0,1,1,0,0,0,1,0, + 0,1,1,0,1,0,0,0, + 0,1,1,1,1,0,0,0, + 0,1,1,0,1,0,0,0, + 0,1,1,0,0,0,1,0, + 1,1,1,1,1,1,1,0, + // la F + 1,1,1,1,1,1,1,0, + 0,1,1,0,0,0,1,0, + 0,1,1,0,1,0,0,0, + 0,1,1,1,1,0,0,0, + 0,1,1,0,1,0,0,0, + 0,1,1,0,0,0,0,0, + 1,1,1,1,0,0,0,0, + // la G + 0,0,1,1,1,1,0,0, + 0,1,1,0,0,1,1,0, + 1,1,0,0,0,0,0,0, + 1,1,0,0,0,0,0,0, + 1,1,0,0,1,1,1,0, + 1,1,0,0,0,1,1,0, + 0,1,1,1,1,1,1,0, + // la H + 0,1,1,0,0,1,1,0, + 0,1,1,0,0,1,1,0, + 0,1,1,0,0,1,1,0, + 0,1,1,1,1,1,1,0, + 0,1,1,0,0,1,1,0, + 0,1,1,0,0,1,1,0, + 0,1,1,0,0,1,1,0, + // la I + 0,1,1,1,1,1,1,0, + 0,0,0,1,1,0,0,0, + 0,0,0,1,1,0,0,0, + 0,0,0,1,1,0,0,0, + 0,0,0,1,1,0,0,0, + 0,0,0,1,1,0,0,0, + 0,1,1,1,1,1,1,0, + // la J + 0,0,0,1,1,1,1,0, + 0,0,0,0,1,1,0,0, + 0,0,0,0,1,1,0,0, + 0,0,0,0,1,1,0,0, + 1,1,0,0,1,1,0,0, + 1,1,0,0,1,1,0,0, + 0,1,1,1,1,0,0,0, + // la K + 1,1,1,0,0,1,1,0, + 0,1,1,0,0,1,1,0, + 0,1,1,0,1,1,0,0, + 0,1,1,1,1,0,0,0, + 0,1,1,0,1,1,0,0, + 0,1,1,0,0,1,1,0, + 1,1,1,0,0,1,1,0, + // la L + 1,1,1,1,0,0,0,0, + 0,1,1,0,0,0,0,0, + 0,1,1,0,0,0,0,0, + 0,1,1,0,0,0,0,0, + 0,1,1,0,0,0,1,0, + 0,1,1,0,0,1,1,0, + 1,1,1,1,1,1,1,0, + // la M + 1,1,0,0,0,1,1,0, + 1,1,1,0,1,1,1,0, + 1,1,1,1,1,1,1,0, + 1,1,1,1,1,1,1,0, + 1,1,0,1,0,1,1,0, + 1,1,0,0,0,1,1,0, + 1,1,0,0,0,1,1,0, + // la N + 1,1,0,0,0,1,1,0, + 1,1,1,0,0,1,1,0, + 1,1,1,1,0,1,1,0, + 1,1,0,1,1,1,1,0, + 1,1,0,0,1,1,1,0, + 1,1,0,0,0,1,1,0, + 1,1,0,0,0,1,1,0, + // la ¥ + 0,1,1,0,0,0,1,0, + 1,0,0,1,1,1,0,0, + 0,0,0,0,0,0,0,0, + 1,1,1,0,0,1,1,0, + 1,1,0,1,0,1,1,0, + 1,1,0,0,1,1,1,0, + 1,1,0,0,0,1,1,0, + // la O + 0,0,1,1,1,0,0,0, + 0,1,1,0,1,1,0,0, + 1,1,0,0,0,1,1,0, + 1,1,0,0,0,1,1,0, + 1,1,0,0,0,1,1,0, + 0,1,1,0,1,1,0,0, + 0,0,1,1,1,0,0,0, + // la P + 1,1,1,1,1,1,0,0, + 0,1,1,0,0,1,1,0, + 0,1,1,0,0,1,1,0, + 0,1,1,1,1,1,0,0, + 0,1,1,0,0,0,0,0, + 0,1,1,0,0,0,0,0, + 1,1,1,1,0,0,0,0, + // la Q + 0,0,1,1,1,0,0,0, + 0,1,1,0,1,1,0,0, + 1,1,0,0,0,1,1,0, + 1,1,0,0,0,1,1,0, + 1,1,0,1,1,0,1,0, + 1,1,0,0,1,1,0,0, + 0,1,1,1,0,1,1,0, + // la R + 1,1,1,1,1,1,0,0, + 0,1,1,0,0,1,1,0, + 0,1,1,0,0,1,1,0, + 0,1,1,1,1,1,0,0, + 0,1,1,0,1,1,0,0, + 0,1,1,0,0,1,1,0, + 1,1,1,1,0,1,1,0, + // la S + 0,0,1,1,1,1,0,0, + 0,1,1,0,0,1,1,0, + 0,1,1,0,0,0,0,0, + 0,0,1,1,1,1,0,0, + 0,0,0,0,0,1,1,0, + 0,1,1,0,0,1,1,0, + 0,0,1,1,1,1,0,0, + // la T + 0,1,1,1,1,1,1,0, + 0,1,0,1,1,0,1,0, + 0,0,0,1,1,0,0,0, + 0,0,0,1,1,0,0,0, + 0,0,0,1,1,0,0,0, + 0,0,0,1,1,0,0,0, + 0,0,1,1,1,1,0,0, + // la U + 0,1,1,0,0,1,1,0, + 0,1,1,0,0,1,1,0, + 0,1,1,0,0,1,1,0, + 0,1,1,0,0,1,1,0, + 0,1,1,0,0,1,1,0, + 0,1,1,0,0,1,1,0, + 0,0,1,1,1,1,0,0, + // la V + 0,1,1,0,0,1,1,0, + 0,1,1,0,0,1,1,0, + 0,1,1,0,0,1,1,0, + 0,1,1,0,0,1,1,0, + 0,1,1,0,0,1,1,0, + 0,0,1,1,1,1,0,0, + 0,0,0,1,1,0,0,0, + // la W + 1,1,0,0,0,1,1,0, + 1,1,0,0,0,1,1,0, + 1,1,0,0,0,1,1,0, + 1,1,0,1,0,1,1,0, + 1,1,1,1,1,1,1,0, + 1,1,1,0,1,1,1,0, + 1,1,0,0,0,1,1,0, + // la X + 1,1,0,0,0,1,1,0, + 0,1,1,0,1,1,0,0, + 0,0,1,1,1,0,0,0, + 0,0,1,1,1,0,0,0, + 0,1,1,0,1,1,0,0, + 1,1,0,0,0,1,1,0, + 1,1,0,0,0,1,1,0, + // la Y + 0,1,1,0,0,1,1,0, + 0,1,1,0,0,1,1,0, + 0,1,1,0,0,1,1,0, + 0,0,1,1,1,1,0,0, + 0,0,0,1,1,0,0,0, + 0,0,0,1,1,0,0,0, + 0,0,1,1,1,1,0,0, + // la Z + 1,1,1,1,1,1,1,0, + 1,1,0,0,0,1,1,0, + 0,0,0,0,1,1,0,0, + 0,0,0,1,1,0,0,0, + 0,0,1,1,0,0,1,0, + 0,1,1,0,0,1,1,0, + 1,1,1,1,1,1,1,0, + }; + +void muevel(); +void main() +{ +int gdriver=DETECT,gmode; +initgraph(&gdriver,&gmode,""); +muevel(); +closegraph(); +} + +//funcion que mueve letras +void muevel() +{ + // a para los 360 y para vertical y matriz + // x1 para posicion x + // y1 para posicion y + // v calcula seno + // i1 incrementa x1 + // c1 vuelve a posicionar + int V; + int a=0,x=0,y=0,c1=640,ac1=c1; + int finali=8,c=0,i=0,c3=0; + int r=0,i1=0,ac3=0,c4=0; + int n[100],l; + l=strlen(texto/*[0]*/); + //lee letras y las pone a numeros + for(a=0;a=c1||c1<0) {i++;} + if(i==finali) {i=finali-8;c3++;} + x=x+10; + if(x==640) + { + c1=ac1;x=0;y=y+10;c3=ac3;c=c+8;i=c+i1;finali=c+8;} + } + + //cosas + x=0;y=0; + //matriz i + finali=8; + //linea + i=0; + //cada linea + c=0; + //rota paleta + delay(10); + c1=c1-10; + + ac1=c1; + //condicion + + if(c1<0) + { + i1=0; + //recalcula + if(c1>-640) + r=10; + else + r=abs(c1)-640; + while(y LineaC ); + PT++; + } +} + +void PTextos( char *file ) +{ + FILE *PFio; + PTexto *PTxt, *p_aux; + int NumL; + + if ( ( PFio = fopen( file, "rw+" ) ) == NULL ) + { + // No se puede abrir el fichero -ERROR- + return; + } else { + // Seguimos + // No hay memoria -ERROR- + return; + p_aux = PTxt; + NumL = 1; + while ( !eof( PFio ) ) + { + NumL++; + if ( ( PTxt = (PTexto *)calloc( sizeof(PTexto *), NumL ) ) == NULL ) + { + // -ERROR + return; + } + if ( p_aux -> LineaC = (char *)calloc( sizeof( char ), 80 ) ) == NULL ) + { + // -ERROR- + return; + } else { + // Leemos el caracter + fscanf( PFio, "%80s", p_aux -> LineaC ); + } + p_aux = &paux[NumL]; + }; + + RefreshTexto( PTxt, NumL, 0 ); + + NLvisual = 0; + NLvistras = 0; + ok = 0; + while ( !ok ) + { + while( !kbhit() ); + switch( getch() ) + { + // Teclas especiales + case 0: + switch( getch() ) + { + + }; + break; + default: + // Editamos la linea + Captura( 2, NLvisual, PTxt[NLvisual+NLvistras].PLinea ); + } + + }; + + + } + +} diff --git a/PROCE b/PROCE new file mode 100644 index 0000000..eb87c8c Binary files /dev/null and b/PROCE differ diff --git a/PROGRAMA.CPP b/PROGRAMA.CPP new file mode 100644 index 0000000..ba53839 --- /dev/null +++ b/PROGRAMA.CPP @@ -0,0 +1,423 @@ +//bibliotecas empleadas +#include +#include +#include +#include +//declaracion de funciones +void inicio(); +void recuadro(int x,int y,int x1,int y1); +void principal(void); +void orden(int numeros[4],int ordenado[4]); +char menu(char o); +char menu1(char peliculas[4][15],int sesiones[3],int salas[4]); +char menu2(char peliculas[4][15],int sesiones[3],int cliente[100][3], + int importe[50],int c[1]); +char menu3(int cliente[100][3],int importe[50],int c[1]); +void error(void); +void final(void); +//funcion principal +void main(void) +{ + clrscr(); + principal(); +} +//funcion que llama a todas las funciones +void principal() +{ +char o=' '; +char peliculas[4][15]={"0","0","0","0"}; +int sesiones[3]={0,0,0}; +int salas[4]={0,0,0,0}; +int cliente[100][3]; +int importe[50]; +int i,i1; +int c[1]={0}; + //inicializa cliente + for(i=0;i<3;i++) + for(i1=0;i1<100;i1++) + cliente[i1][i]=0; + //inicializa importe + for(i=0;i<50;i++) + importe[i]=0; + + inicio(); + while(o!='4') + { + o=menu(o); + switch(o) + { + case '1': + o=menu1(peliculas,sesiones,salas); + break; + case '2': + o=menu2(peliculas,sesiones,cliente,importe,c); + break; + case '3': + o=menu3(cliente,importe,c); + break; + case '4': + final(); + break; + default : + error(); + } + } +} +//funcion crea un recuadro en la coordenadas indicadas +void recuadro(int x,int y,int x1,int y1) +{ +int a,b; + for(a=x;a!=x1+1;a++) + for(b=y;b!=y1+1;b++) + { + gotoxy(a,b); + cprintf("Û"); + } + +} +//funcion para el menu principal +char menu(char o) +{ + textbackground(0); + clrscr(); + textcolor(4); + recuadro(26,8,56,18); + textbackground(4); + textcolor(15); + gotoxy(28,10); + cprintf("1.-Peliculas en proyeccion"); + gotoxy(28,12); + cprintf("2.-Ventas"); + gotoxy(28,14); + cprintf("3.-Resultados"); + gotoxy(28,16); + cprintf("4.-Finalizar el programa"); + if(o==' ')o=getch(); + return o; +} +//menu primero +char menu1(char peliculas[4][15],int sesiones[3],int salas[4]) +{ +char o='0',pp='0'; +int i,n; + textbackground(0); + textcolor(1); + recuadro(3,3,34,12); + textbackground(1); + textcolor(15); + gotoxy(4,4); + cprintf("1.-Dar de alta a 4 peliculas"); + gotoxy(4,6); + cprintf("2.-Modificar una pelicula"); + gotoxy(4,8); + cprintf("3.-Precios para las sesiones"); + gotoxy(4,10); + cprintf("4.-Capacidad de las salas"); + gotoxy(27,24); + cprintf("úPulse para regresarú"); + o=getch(); + switch(o) + { + //Dar de alta a 4 peliculas + case '1': + clrscr(); + for(i=0;i<4;i++) + { + gotoxy(30,i+12); + cprintf("Introduzca Pelicula %i¦:",i+1); + gotoxy(53,i+12); + gets(peliculas[i]); + //gotoxy(53,i+12); + //printf(" "); + } + break; + //modificar una pelicula + case '2': + clrscr(); + for(i=0;i<4;i++) + { + gotoxy(30,12+i); + cprintf("%i.-%s",i+1,peliculas[i]); + } + gotoxy(25,18); + cprintf("Introduzca pelicula a cambiar:"); + scanf("%d",&n); + //se pone getchar porque sino no sale + getchar(); + gotoxy(25,20); + cprintf("Introduzca nuevo nombre:"); + gets(peliculas[n-1]); + break; + //poner los precios de las 3 sesiones + case '3': + clrscr(); + for(i=0;i<3;i++) + { + gotoxy(30,i+12); + cprintf("Precio de la %i¦ Sesi¢n: ",i+1); + gotoxy(54,i+12); + scanf("%d",&sesiones[i]); + //gotoxy(53,12); + //printf(" "); + } + break; + //capacidad de las 4 salas + case '4': + clrscr(); + for(i=0;i<4;i++) + { + if(i==0)pp='A'; + if(i==1)pp='B'; + if(i==2)pp='C'; + if(i==3)pp='D'; + gotoxy(30,i+12); + cprintf("Capacidad de sala %c:",pp); + gotoxy(52,i+12); + scanf("%i",&salas[i]); + //gotoxy(51,12); + //printf(" "); + } + break; + default : + if(o!=' ') error(); + } +if(o==' ') return ' '; +else return '1'; +} +//menu segundo +char menu2(char peliculas[4][15],int sesiones[3],int cliente[100][3],int importe[50],int c[1]) +{ +char pp; +int i,n,ent,sesi; + textbackground(2); + textcolor(15); + + clrscr(); + gotoxy(27,24); + cprintf("úPulse para regresarú"); + printf("\t\t\t SELECCIONE UNA PELICULA"); + for(i=0;i<4;i++) + { + if(i==0)pp='A'; + if(i==1)pp='B'; + if(i==2)pp='C'; + if(i==3)pp='D'; + gotoxy(10,5+i); + cprintf("%i.-%s EN LA SALA %c",i+1,peliculas[i],pp); + } + gotoxy(13,10); + cprintf("Elija pelicula:"); + scanf("%i",&n); + cliente[c[1]][0]=n; + if(n==1)pp='A'; + if(n==2)pp='B'; + if(n==3)pp='C'; + if(n==4)pp='D'; + //clrscr(); + printf("\t\t\t SELECCIONE UNA SESION"); + gotoxy(18,13);for(i=0;i<3;i++) + { + gotoxy(39,15+i); + cprintf("%i.-%d",i+1,sesiones[i]); + } + gotoxy(42,19); + cprintf("Elija sesion:"); + scanf("%i",&n); + cliente[c[1]][1]=n;sesi=n; + + //clrscr(); + printf("\t\t\t SELECCIONE UNA ENTRADA"); + gotoxy(45,22); + cprintf("Numero de entradas:"); + scanf("%i",&n);ent=n; + cliente[c[1]][2]=n; + + clrscr(); + //calculo del importe + importe[c[1]]=(cliente[c[1]][2])*(sesiones[cliente[c[1]][1]-1]); + gotoxy(34,9); + cprintf("PELICULA: %s en sala %c",peliculas[cliente[c[1]][0]],pp); + gotoxy(34,11); + cprintf("%i entradas para la %i¦ sesi¢n ",ent,sesi); + gotoxy(34,13); + cprintf("IMPORTE TOTAL:%i",importe[c[1]]); + c[1]++; + getch(); +return ' '; +} +//menu tercero +char menu3(int cliente[100][3],int importe[50],int c[1]) +{ +char o='0'; +int i; +int suma[4]={0,0,0,0},sumax[4]={0,0,0,0}; + + textbackground(0); + textcolor(3); + recuadro(49,14,80,24); + textbackground(3); + textcolor(15); + gotoxy(52,16); + cprintf("1.-Localidades por sala"); + gotoxy(52,19); + cprintf("2.-Importe total de ventas"); + gotoxy(52,22); + cprintf("3.-Localidades por sesion"); + gotoxy(27,24); + cprintf("úPulse para regresarú"); + o=getch(); + switch(o) + { + case '1': + clrscr(); + for(i=0;i34;x--) +{ +pp=x*20; +gotoxy(x,12); +cprintf("%s ",texto); +sound(pp); +delay(10); +nosound(); +delay(25); +} +delay(1000); +for(y=13;y!=24;y++) +for(x=35;x<45;x=x+2) + { + pp=y*20;pa=x*100; + gotoxy(x,y-1); + cprintf(" "); + gotoxy(x,y); + cprintf("%c",texto[x-35]); + sound(pp); + delay(10); + nosound(); + gotoxy(x+1,25-y); + cprintf(" "); + gotoxy(x+1,24-y); + cprintf("%c",texto[x-34]); + sound(pa); + delay(10); + nosound(); + delay(50); + } +} +//final del programa +void final() +{ +int x,y; +textbackground(0); +for(y=8;y<19;y++) + { + for(x=26;x<57;x++) + { + gotoxy(x,y); + cprintf(" "); + delay(10); + } + } +} +void orden(int numeros[4],int ordenado[4]) +{ + //int numeros[4]={1,5,6,4}; + //int ordenado[4]={0,0,0,0}; + int a=0,i,ind[4]={-1,-1,-1,-1}; + clrscr(); + while(a<4) + { + for(i=0;i<4;i++) + { + if((numeros[i]>ordenado[a])&&(ind[0]!=i)&&(ind[1]!=i)&&(ind[2]!=i)) + { + ordenado[a]=numeros[i]; + ind[a]=i; + } + } + a++; + } + + for(i=0;i<4;i++) + { + printf("%i",ordenado[i]); + } + +} \ No newline at end of file diff --git a/PROGRAMA.EXE b/PROGRAMA.EXE new file mode 100644 index 0000000..da248d1 Binary files /dev/null and b/PROGRAMA.EXE differ diff --git a/PRUEBA.TXT b/PRUEBA.TXT new file mode 100644 index 0000000..e69de29 diff --git a/PSEUDOC.TXT b/PSEUDOC.TXT new file mode 100644 index 0000000..caf82cd Binary files /dev/null and b/PSEUDOC.TXT differ diff --git a/README.md b/README.md new file mode 100644 index 0000000..885a1e3 --- /dev/null +++ b/README.md @@ -0,0 +1,9 @@ +#OSCAR + + +*16/08/1996* + +ToDo: wwtcf? + + +![screenshot](/OSCAR.png "Screenshot") diff --git a/SVGA256.BGI b/SVGA256.BGI new file mode 100644 index 0000000..f74bc72 Binary files /dev/null and b/SVGA256.BGI differ diff --git a/TEL.DAT b/TEL.DAT new file mode 100644 index 0000000..e69de29 diff --git a/TEXTO.BAK b/TEXTO.BAK new file mode 100644 index 0000000..4c90577 --- /dev/null +++ b/TEXTO.BAK @@ -0,0 +1,137 @@ +#include +#include +#include + + +#define ANCHO 80 +#define ALTOini 5 +#define ALTO 20 +#define ARRIBA 72 +#define ABAJO 80 + + + + +void MuestraLinea( char Como, char Donde, char *Quien ) +{ + if ( Como ) + { + textattr( 1 ); + } else { + textattr( 5 ); + } + + // Borramos la linearrr + + gotoxy( 2, Donde+ALTOini ); + cprintf( "%s", Quien ); +}; + +void ObtenLinea( FILE *PT, int LINEA, char *Buffer ) +{ + fseek( PT, sizeof(char)*ANCHO*LINEA, SEEK_SET ); + fread( &Buffer, ANCHO*sizeof(char), 1, PT ); +}; + +void PonLinea( FILE *PT, int LINEA, char *Buffer ) +{ + fseek( PT, sizeof(char)*ANCHO*LINEA, SEEK_SET ); + fwrite( &Buffer, ANCHO*sizeof(char), 1, PT ); +}; + + +void RefreshTexto( FILE *PT, int NLinicio ) +{ + char Buffer[ANCHO+1]; + int i; + + i = 0; + while ( !feof( PT ) && i < 22 ) + { + ObtenLinea( PT, (i+NLinicio), Buffer ); + MuestraLinea( 0, i, Buffer ); + i++; + } +}; + + +void PTextos( char *file ) +{ + FILE *PTxt; + int Lvisual, Lrestante; + char ok = 0; + char Buffer[ANCHO+1]; + + clrscr(); + + if ( ( PTxt = fopen( file, "w+b" ) ) == NULL ) + { + //--ERROR + return; + } else { + Lvisual = 0; + Lrestante = 0; + RefreshTexto( PTxt, Lvisual+Lrestante ); + ok = 0; + do { + + MuestraLinea( 1, Lvisual, Buffer ); + while( !kbhit() ); + MuestraLinea( 0, Lvisual, Buffer ); + + switch ( getch() ) + { + case 27: + ok = 1; + break; + case 0: + switch ( getch() ) + { + case ARRIBA: + Lvisual --; + if ( Lvisual < 0 ) + { + Lvisual = 0; + Lrestante --; + if ( Lrestante < 0 ) + Lrestante = 0; + } + + RefreshTexto( PTxt, Lvisual + Lrestante ); + ObtenLinea( PTxt, Lvisual + Lrestante, Buffer ); + break; + case ABAJO: + Lvisual ++; + if ( Lvisual > ALTO ) + { + Lvisual = ALTO; + Lrestante ++; + // Deberias controlar las lineas intermedias, para ponerlas a cero + } + + RefreshTexto( PTxt, Lvisual + Lrestante ); + ObtenLinea( PTxt, Lvisual + Lrestante, Buffer ); + break; + } + default: + // Editamos la linearrr +//******************************************************************************** +// EditaLinea( 2, Lvisual, Buffer ); +//******************************************************************************** + sprintf( Buffer, "Linea %d", Lvisual + Lrestante ); + PonLinea( PTxt, Lvisual + Lrestante, Buffer ); + break; + + } + } while ( !ok ); + + fclose( PTxt ); + } + +}; + + +void main( void ) +{ + PTextos( "Prueba.txt" ); +} diff --git a/TEXTO.CPP b/TEXTO.CPP new file mode 100644 index 0000000..af825c0 --- /dev/null +++ b/TEXTO.CPP @@ -0,0 +1,139 @@ +#include +#include +#include + + +#define ANCHO 80 +#define ALTOini 5 +#define ALTO 20 +#define ARRIBA 72 +#define ABAJO 80 + + + + +void MuestraLinea( char Como, char Donde, char *Quien ) +{ + if ( Como ) + { + textattr( 1 ); + } else { + textattr( 5 ); + } + + // Borramos la linearrr + + gotoxy( 2, Donde+ALTOini ); + cprintf( "%s", Quien ); +}; + +void ObtenLinea( FILE *PT, int LINEA, char *Buffer ) +{ + fseek( PT, sizeof(char)*ANCHO*LINEA, SEEK_SET ); + fread( &Buffer, ANCHO*sizeof(char), 1, PT ); +}; + +void PonLinea( FILE *PT, int LINEA, char *Buffer ) +{ + fseek( PT, sizeof(char)*ANCHO*LINEA, SEEK_SET ); + fwrite( &Buffer, ANCHO*sizeof(char), 1, PT ); +}; + + +void RefreshTexto( FILE *PT, int NLinicio ) +{ + char Buffer[ANCHO+1]; + int i; + + i = 0; + while ( !feof( PT ) && i < 22 ) + { + ObtenLinea( PT, (i+NLinicio), Buffer ); + MuestraLinea( 0, i, Buffer ); + i++; + } +}; + + +void PTextos( char *file ) +{ + FILE *PTxt; + int Lvisual, Lrestante; + char ok = 0; + char Buffer[ANCHO+1]; + + clrscr(); + + if ( ( PTxt = fopen( file, "w+b" ) ) == NULL ) + { + //--ERROR + return; + } else { + Lvisual = 0; + Lrestante = 0; + RefreshTexto( PTxt, Lvisual+Lrestante ); + ObtenLinea( PTxt, Lvisual + Lrestante, Buffer ); + + ok = 0; + do { + + MuestraLinea( 1, Lvisual, Buffer ); + while( !kbhit() ); + MuestraLinea( 0, Lvisual, Buffer ); + + switch ( getch() ) + { + case 27: + ok = 1; + break; + case 0: + switch ( getch() ) + { + case ARRIBA: + Lvisual --; + if ( Lvisual < 0 ) + { + Lvisual = 0; + Lrestante --; + if ( Lrestante < 0 ) + Lrestante = 0; + } + + RefreshTexto( PTxt, Lvisual + Lrestante ); + ObtenLinea( PTxt, Lvisual + Lrestante, Buffer ); + break; + case ABAJO: + Lvisual ++; + if ( Lvisual > ALTO ) + { + Lvisual = ALTO; + Lrestante ++; + // Deberias controlar las lineas intermedias, para ponerlas a cero + } + + RefreshTexto( PTxt, Lvisual + Lrestante ); + ObtenLinea( PTxt, Lvisual + Lrestante, Buffer ); + break; + } + default: + // Editamos la linearrr +//******************************************************************************** +// EditaLinea( 2, Lvisual, Buffer ); +//******************************************************************************** + sprintf( Buffer, "Linea %d", Lvisual + Lrestante ); + PonLinea( PTxt, Lvisual + Lrestante, Buffer ); + break; + + } + } while ( !ok ); + + fclose( PTxt ); + } + +}; + + +void main( void ) +{ + PTextos( "Prueba.txt" ); +} diff --git a/TEXTO.EXE b/TEXTO.EXE new file mode 100644 index 0000000..67eb9e0 Binary files /dev/null and b/TEXTO.EXE differ diff --git a/TEXTO.OBJ b/TEXTO.OBJ new file mode 100644 index 0000000..aa7c657 Binary files /dev/null and b/TEXTO.OBJ differ diff --git a/TEXTO.PIF b/TEXTO.PIF new file mode 100644 index 0000000..f61dfb2 Binary files /dev/null and b/TEXTO.PIF differ diff --git a/TOROS b/TOROS new file mode 100644 index 0000000..7b71c6e --- /dev/null +++ b/TOROS @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/TRESRAYA.CPP b/TRESRAYA.CPP new file mode 100644 index 0000000..dc6d077 --- /dev/null +++ b/TRESRAYA.CPP @@ -0,0 +1,249 @@ +/////////////////////////////////TRES EN RALLA//////////////////////////////// +#include +#include +#include +#include +#include + + +extern unsigned _stklen = 4096; +///////////////////////////DECLARACION DE FUNCIONES/////////////////////////// +void jugador1(int array[3][3]); +void jugador2(int array[3][3]); +void ordenador(int array[3][3],char opcion); +void dibujamalla(); +int comprobacion(int array[3][3]); +char menu(); + +//////////////////////////////FUNCION PRINCIPAL/////////////////////////////// +void main() +{ +char opcion; +int array[3][3]; +int x,y,a=0,c=0; +int gdriver=DETECT,gmode; +initgraph(&gdriver,&gmode,"c:\\program\\borlandc\\bgi"); +clearviewport(); +//INICIALIZACION DE ARRAY +for(x=0;x<3;x++) +for(y=0;y<3;y++) +array[x][y]=0; +////////////////////////////////JUEGO PRINCIPAL/////////////////////////////// +opcion=menu(); +dibujamalla(); +while(a==0&&c<5) + { + if(opcion=='1') + { + jugador1(array); + if(c!=4) jugador2(array); + a=comprobacion(array); + c++; + } + else + { + jugador1(array); + if(c!=4) ordenador(array,opcion); + a=comprobacion(array); + c++; + } + } +///////////////////////////////RESULTADO FINAL//////////////////////////////// +setcolor(2); +if(a==0) outtextxy(310,400,"EMPATAMOS"); +if(a==1) outtextxy(270,400,"GANAS TU:MATI WOMAN"); +if(a==2) outtextxy(270,400,"GANO YO:OSCAR COMPUTER"); +getch(); +closegraph(); +} + +////////////////////////////////////MENU////////////////////////////////////// +char menu() +{ +char o='0'; +outtextxy(230,230,"1.-DOS JUGADORES"); +outtextxy(230,250,"2.-CONTRA EL ORDENADOR"); +while(o!='1'&&o!='2') + { + o=getch(); + } +clearviewport(); +if(o=='2') + { + o='0'; + outtextxy(230,230,"1.-NIVEL APLATANADO"); + outtextxy(230,250,"2.-NIVEL ENCABRONAO"); + while(o!='1'&&o!='2') + { + o=getch(); + } + if(o=='1') o='3'; else o='4'; + } +clearviewport(); +return o; +} + +//////////////////////COMPROBACION DEL TRES EN RALLA////////////////////////// +int comprobacion(int array[3][3]) + +{ +int x,y,w=0,suma=0,suma1=0,suma2=0,suma3=0; + +//////////////////LECTURA DEL ARRAY HORIZONTAL Y VERTICAL///////////////////// +for(x=0;x<3;x++) + { + for(y=0;y<3;y++) + { + if(array[x][y]==1) suma++; + if(array[x][y]==2) suma1++; + if(array[y][x]==1) suma2++; + if(array[y][x]==2) suma3++; + } + if(suma==3||suma2==3) w=1; + if(suma1==3||suma3==3) w=2; + suma=0;suma1=0;suma2=0;suma3=0; +} + +//////////////////////LECTURA DEL ARRAY DIAGONAL////////////////////////////// +suma=0;suma1=0;suma2=0;suma3=0; +for(x=0;x<3;x++) + { + if(array[x][x]==1) suma++; + if(array[x][x]==2) suma1++; + if(array[2-x][x]==1) suma2++; + if(array[2-x][x]==2) suma3++; + + } + if(suma==3||suma2==3) w=1; + if(suma1==3||suma3==3) w=2; + +////////////////VALOR DEVUELTO DEL ANALISIS DEL ARRAY///////////////////////// +return w; +} + +////////////////////////////////DIBUJA MALLA////////////////////////////////// +void dibujamalla() +{ +int x,y; +setcolor(15); +for(x=300;x<400;x+=30) + { + y=150; + line(x,y,x,y+200); + line(y+100,x-100,y+290,x-100); + } +} + +/////////////////////////////////JUGADOR1///////////////////////////////////// +void jugador1(int array[3][3]) +{ +int a,b; +//JUEGAS TU +outtextxy(1,1,"Introduce coordenada[x,y]:"); +gotoxy(27,1); +scanf("%i,%i",&a,&b); +gotoxy(27,1); +printf(" "); +while(a<1||a>3||b<1||b>3||array[a-1][b-1]!=0) +{ +outtextxy(200,400,"Introduzca coordenada correcta(pulsa tecla)"); +getch(); +setcolor(0); +outtextxy(200,400,"Introduzca coordenada correcta(pulsa tecla)"); +gotoxy(27,1); +scanf("%i,%i",&a,&b); +gotoxy(27,1); +printf(" "); +} +array[a-1][b-1]=1; +setcolor(5); +circle(315+((a-1)*30),215+((b-1)*30),10); +} + +/////////////////////////////////JUGADOR2///////////////////////////////////// +void jugador2(int array[3][3]) +{ +int a,b; +//JUEGAS TU +outtextxy(1,1,"Introduce coordenada[x,y]:"); +gotoxy(27,1); +scanf("%i,%i",&a,&b); +gotoxy(27,1); +printf(" "); +while(a<1||a>3||b<1||b>3||array[a-1][b-1]!=0) + { + outtextxy(200,400,"Introduzca coordenada correcta(pulsa tecla)"); + getch(); + setcolor(0); + outtextxy(200,400,"Introduzca coordenada correcta(pulsa tecla)"); + gotoxy(27,1); + scanf("%i,%i",&a,&b); + gotoxy(27,1); + printf(" "); + } +array[a-1][b-1]=2; +setcolor(3); +circle(315+((a-1)*30),215+((b-1)*30),10); +} + +/////////////////////////////////ORDENADOR///////////////////////////////////// +void ordenador(int array[3][3],char opcion) +{ +int a,b,x=-1,y=-1,r=-1,caso[4]={0,0,0,0},fin=0; +int suma=0,suma1=0,suma2=0,suma3=0; +//JUEGA EL ORDENADOR +if(opcion=='3') +//LECTURA DEL ARRAY +{ +for(a=0;a<3;a++) + { + for(b=0;b<3;b++) + { + if(array[a][b]==1) suma++;//VERTICAL + if(suma==2) {caso[0]=1;r=a;} + if(array[b][a]==1) suma1++;//HORIZONTAL + if(suma1==2) {caso[1]=1;r=a;} + } + if(array[a][a]==1) suma2++;//DIAGONAL + if(suma2==2) caso[2]=1; + if(array[2-a][a]==1) suma3++;//DIAGONAL INVERSA + if(suma3==2) caso[3]=1; + if(suma!=3&&suma1!=3&&suma2!=3&&suma3!=3) + {suma=0;suma1=0;} + else fin=1; + } +if(caso[0]==1) + { + for(a=0;a<3;a++) + if(array[r][a]==0) {y=a;x=r;} + } +if(caso[1]==1&&(x==-1||y==-1)) + { + for(a=0;a<3;a++) + if(array[a][r]==0) {x=a;y=r;} + } +if(caso[2]==1&&(x==-1||y==-1)) + { + for(a=0;a<3;a++) + if(array[a][a]==0) {x=a;y=x;} + } +if(caso[3]==1&&(x==-1||y==-1)) + { + for(a=0;a<3;a++) + if(array[2-a][a]==0) {y=a;x=2-y;} + } +} +if(x==-1||y==-1) + { + for(a=0;a<3;a++) + for(b=0;b<3;b++) + if(array[a][b]==0) {x=a;y=b;} + } +//da valores +if(fin!=1||(x==-1)&&(y==-1)) + { + array[x][y]=2; + setcolor(3); + circle(315+(x*30),215+(y*30),10); + } +} diff --git a/TRESRAYA.EXE b/TRESRAYA.EXE new file mode 100644 index 0000000..3fe5a93 Binary files /dev/null and b/TRESRAYA.EXE differ diff --git a/TUNEL.CPP b/TUNEL.CPP new file mode 100644 index 0000000..7a54ed0 --- /dev/null +++ b/TUNEL.CPP @@ -0,0 +1,96 @@ +#include +#include +#include +#include +#include + +void Putpixel( int x, int y, char c) +{ + if ( x < 0 || x >= 320 ) return; + if ( y < 0 || y >= 200 ) return; + + // { Written by Matt Sottile } + asm mov ax,y + asm mov bx,ax + asm shl ax,8 + asm shl bx,6 + asm add bx,ax + asm add bx,x + asm mov ax,0xa000 + asm mov es,ax + asm mov al,c + asm mov es:[bx],al +}; + + +void main(void) +{ + int a=0,b=90; + int i; + float ca, vsin[360]; + + int gdriver=1,gmode=0; + initgraph(&gdriver,&gmode,"d:\\program\\borlandc\\bgi"); +/* + asm mov ax, 0x13 + asm int 0x10 +*/ + for(ca=0;a<360;ca=ca+0.0174533) + { + vsin[a]=sin(ca); + a++; + } + + int Mov = 0, SMov=0; + int oldMov, MULTI; + int X, Y, X1, Y1; + + while(kbhit())getch(); + while( !kbhit() ) + { + oldMov = SMov; + + SMov = (SMov++) % 360; + + Mov = SMov; + + + #define SEPARACION 7 + for(a=0;a< 18;a++) + { + Mov = (Mov + 25)%360; + oldMov = (oldMov + 25)%360; + + X = 160+vsin[(oldMov)]*40; + Y = 100+vsin[(oldMov)]*10; + + X1 = 160+vsin[(Mov)]*40; + Y1 = 100+vsin[(Mov)]*10; + MULTI = (140-a*SEPARACION); + + for(i=0;i<360;i+=4) + { + if(b>=360) b=0; +// putpixel( a+ ceil(90*vsin[b]),ceil(200+50*vsin[a])+ceil(90*vsin[i]),10); + putpixel( X + MULTI*vsin[b], Y + MULTI*vsin[i], 0); + + putpixel( X1 + MULTI*vsin[b], Y1 + MULTI*vsin[i],10); + + b+=4; + } +// getch(); +// delay(10); + b=90; + } + + } +/* + asm mov ax, 3 + asm int 0x10 +*/ + + restorecrtmode(); + closegraph(); + getch(); + +} diff --git a/TUNEL.EXE b/TUNEL.EXE new file mode 100644 index 0000000..def1a56 Binary files /dev/null and b/TUNEL.EXE differ