First commit 16/08/1996
This commit is contained in:
commit
0f24b3477e
836
AGENDA.CPP
Normal file
836
AGENDA.CPP
Normal file
@ -0,0 +1,836 @@
|
||||
//BIBLIOTECAS EMPLEADAS
|
||||
//Bibliotecas
|
||||
#include<math.h>
|
||||
#include<ctype.h>
|
||||
#include<alloc.h>
|
||||
#include<string.h>
|
||||
#include<dos.h>
|
||||
#include<stdio.h>
|
||||
#include<bios.h>
|
||||
#include<conio.h>
|
||||
|
||||
//VARIABLES GLOBALES
|
||||
struct datos{ char nombre[20];
|
||||
char apodo[20];
|
||||
char numero[20];
|
||||
|
||||
}datos;
|
||||
|
||||
typedef struct nodo{ char nombre[20];
|
||||
char apodo[20];
|
||||
char numero[20];
|
||||
struct nodo *sig;
|
||||
}INFO;
|
||||
|
||||
struct simbolo{ char letra;
|
||||
|
||||
}simbolo;
|
||||
|
||||
typedef struct nodo1{ char letra;
|
||||
struct nodo1 *sig;
|
||||
struct nodo1 *ant;
|
||||
|
||||
}LET;
|
||||
int matriz1;
|
||||
char matriz2[80];
|
||||
|
||||
//DECLARACION DE FUNCIONES
|
||||
void diario(int subopcion);
|
||||
void captura(int tam,int elec,char nombre[80],int x,int y);
|
||||
void telefonos(int subopcion);
|
||||
INFO * recupera();
|
||||
void introducir(INFO *plista);
|
||||
INFO * borrar(INFO *plista);
|
||||
void contenido(INFO *plista);
|
||||
void busca(INFO *plista);
|
||||
void visualizaag(void);
|
||||
LET * introduceag(void);
|
||||
void hora(void);
|
||||
void creditos(void);
|
||||
void dibujaeleccion(int opcion);
|
||||
int dibujasubmenu1(int opcion);
|
||||
void recuadro(int x,int y,int x1,int y1,int o);
|
||||
void marco(int x,int y,int x1,int y1);
|
||||
void menu(void);
|
||||
|
||||
//FUNCION PRINCIPAL
|
||||
void main()
|
||||
{
|
||||
int opcion=1,a=0;
|
||||
clrscr();
|
||||
textbackground(0);
|
||||
_setcursortype(_NOCURSOR);
|
||||
menu();
|
||||
while(opcion!=4||a!=7181)
|
||||
{
|
||||
dibujaeleccion(opcion);
|
||||
while(!kbhit())
|
||||
{
|
||||
hora();
|
||||
}
|
||||
a=bioskey(0);
|
||||
if(a==7181&&opcion!=4) opcion=dibujasubmenu1(opcion);
|
||||
if(a==19712) opcion++;
|
||||
if(a==19200) opcion--;
|
||||
if(opcion==0) opcion=4;
|
||||
if(opcion==5) opcion=1;
|
||||
}
|
||||
_setcursortype(_NORMALCURSOR);
|
||||
textbackground(0);
|
||||
clrscr();
|
||||
}
|
||||
|
||||
//DIBUJA EL INTERFAZ GENERAL
|
||||
void menu()
|
||||
{
|
||||
clrscr();
|
||||
textattr(LIGHTGRAY);
|
||||
recuadro(2,2,79,24,1);
|
||||
recuadro(2,1,79,1,0);
|
||||
recuadro(2,25,79,25,0);
|
||||
}
|
||||
|
||||
//DIBUJA ELECCION
|
||||
void dibujaeleccion(int opcion)
|
||||
{
|
||||
textattr(LIGHTGRAY);
|
||||
textattr(127);
|
||||
gotoxy(3,1);
|
||||
cprintf(" DIARIO TELEFONOS INFORMACION FINALIZAR");
|
||||
gotoxy(3,25);
|
||||
cprintf("F1 ayuda");
|
||||
textattr(LIGHTGRAY);
|
||||
switch(opcion)
|
||||
{
|
||||
case 1:gotoxy(8,1);cprintf("DIARIO");break;
|
||||
case 2:gotoxy(24,1);cprintf("TELEFONOS");break;
|
||||
case 3:gotoxy(43,1);cprintf("INFORMACION");break;
|
||||
case 4:gotoxy(64,1);cprintf("FINALIZAR");break;
|
||||
}
|
||||
}
|
||||
//DIBUJA SUBMENUS
|
||||
int dibujasubmenu1(int opcion)
|
||||
{
|
||||
//subopcion son CURSOS,subopcion1 son CLASES DE CURSOS
|
||||
//subopcion son eleccion de submenus
|
||||
int a=0,subopcion1=1,subopcion2=1,subopcion3=1;
|
||||
while(a!=7181&&a!=283)
|
||||
{
|
||||
switch(opcion)
|
||||
{
|
||||
case 1: //DIARIO
|
||||
recuadro(5,2,18,5,2);
|
||||
marco(5,2,18,5);
|
||||
while(a!=7181&&a!=283&&a!=19712&&a!=19200)
|
||||
{
|
||||
textattr(127);
|
||||
gotoxy(7,3);cprintf("INTRODUCIR");
|
||||
gotoxy(7,4);cprintf("VISUALIZAR");
|
||||
textattr(LIGHTGRAY);
|
||||
switch(subopcion1)
|
||||
{
|
||||
case 1: gotoxy(7,3);cprintf("INTRODUCIR");break;
|
||||
case 2: gotoxy(7,4);cprintf("VISUALIZAR");break;
|
||||
}
|
||||
while(!kbhit())
|
||||
{
|
||||
hora();
|
||||
}
|
||||
a=bioskey(0);
|
||||
if(a==20480) subopcion1++;
|
||||
if(a==18432) subopcion1--;
|
||||
if(subopcion1==0) subopcion1=2;
|
||||
if(subopcion1==3) subopcion1=1;
|
||||
}
|
||||
if(a!=283&&a!=19712&&a!=19200) diario(subopcion1);
|
||||
textattr(LIGHTGRAY);recuadro(5,2,19,6,1);
|
||||
break;
|
||||
case 2: //TELEFONO
|
||||
recuadro(24,2,37,7,2);
|
||||
marco(24,2,37,7);
|
||||
while(a!=7181&&a!=283&&a!=19712&&a!=19200)
|
||||
{
|
||||
textattr(127);
|
||||
gotoxy(26,3);cprintf("INTRODUCIR");
|
||||
gotoxy(26,4);cprintf("VER LISTA");
|
||||
gotoxy(26,5);cprintf("BORRAR");
|
||||
gotoxy(26,6);cprintf("BUSCAR");
|
||||
textattr(LIGHTGRAY);
|
||||
switch(subopcion2)
|
||||
{
|
||||
case 1: gotoxy(26,3);cprintf("INTRODUCIR");break;
|
||||
case 2: gotoxy(26,4);cprintf("VER LISTA");break;
|
||||
case 3: gotoxy(26,5);cprintf("BORRAR");break;
|
||||
case 4: gotoxy(26,6);cprintf("BUSCAR");break;
|
||||
}
|
||||
while(!kbhit())
|
||||
{
|
||||
hora();
|
||||
}
|
||||
a=bioskey(0);
|
||||
if(a==20480) subopcion2++;
|
||||
if(a==18432) subopcion2--;
|
||||
if(subopcion2==0) subopcion2=4;
|
||||
if(subopcion2==5) subopcion2=1;
|
||||
}
|
||||
if(a!=283&&a!=19712&&a!=19200)
|
||||
{
|
||||
telefonos(subopcion2);
|
||||
}
|
||||
textattr(LIGHTGRAY);recuadro(24,2,38,8,1);
|
||||
break;
|
||||
case 3: //INFORMACION
|
||||
recuadro(42,2,55,5,2);
|
||||
marco(42,2,55,5);
|
||||
while(a!=7181&&a!=283&&a!=19712&&a!=19200)
|
||||
{
|
||||
textattr(127);
|
||||
gotoxy(46,3);cprintf("AYUDAS");
|
||||
gotoxy(45,4);cprintf("CREDITOS");
|
||||
textattr(LIGHTGRAY);
|
||||
switch(subopcion3)
|
||||
{
|
||||
case 1: gotoxy(46,3);cprintf("AYUDAS");break;
|
||||
case 2: gotoxy(45,4);cprintf("CREDITOS");break;
|
||||
}
|
||||
while(!kbhit())
|
||||
{
|
||||
hora();
|
||||
}
|
||||
a=bioskey(0);
|
||||
if(a==20480) subopcion3++;
|
||||
if(a==18432) subopcion3--;
|
||||
if(subopcion3==0) subopcion3=2;
|
||||
if(subopcion3==3) subopcion3=1;
|
||||
}
|
||||
if(subopcion3==1&&a!=283) hora();
|
||||
else if(a!=283&&a!=19712&&a!=19200) creditos();
|
||||
textattr(LIGHTGRAY);recuadro(42,2,56,6,1);
|
||||
break;
|
||||
case 4: //FINALIZAR
|
||||
while(!kbhit())
|
||||
{
|
||||
hora();
|
||||
}
|
||||
a=bioskey(0);
|
||||
break;
|
||||
}
|
||||
//if(opcion==4) a=bioskey(0);
|
||||
if(a==19712) {a=0;opcion++;}
|
||||
if(a==19200) {a=0;opcion--;}
|
||||
if(opcion==0) opcion=4;
|
||||
if(opcion==5) opcion=1;
|
||||
dibujaeleccion(opcion);
|
||||
}
|
||||
return opcion;
|
||||
}
|
||||
|
||||
|
||||
//FUNCION PARA CREAR UN RECUADRO EN LAS COORDENADAS INDICADAS
|
||||
void recuadro(int x,int y,int x1,int y1,int o)
|
||||
{
|
||||
int a,b;
|
||||
textattr(LIGHTGRAY);
|
||||
for(a=x;a!=x1+1;a++)
|
||||
for(b=y;b!=y1+1;b++)
|
||||
{
|
||||
gotoxy(a,b);
|
||||
if(o==0||o==2) cprintf("Û");
|
||||
else cprintf("²");
|
||||
}
|
||||
if(o==2)
|
||||
{
|
||||
textattr(0);
|
||||
for(a=y+1;a<y1+2;a++)
|
||||
{
|
||||
gotoxy(x1+1,a);
|
||||
cprintf("Û");
|
||||
}
|
||||
for(a=x+1;a<x1+1;a++)
|
||||
{
|
||||
gotoxy(a,y1+1);
|
||||
cprintf("Û");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//FUNCION PARA ENMARCAR UN RECUADRO
|
||||
void marco(int x,int y,int x1,int y1)
|
||||
{
|
||||
int a,b;
|
||||
textattr(127);
|
||||
gotoxy(x,y);
|
||||
cprintf("É");
|
||||
gotoxy(x,y1);
|
||||
cprintf("È");
|
||||
gotoxy(x1,y);
|
||||
cprintf("»");
|
||||
gotoxy(x1,y1);
|
||||
cprintf("¼");
|
||||
|
||||
for(a=x+1;a!=x1;a++)
|
||||
{
|
||||
gotoxy(a,y);
|
||||
cprintf("Í");
|
||||
gotoxy(a,y1);
|
||||
cprintf("Í");
|
||||
|
||||
}
|
||||
|
||||
for(b=y+1;b!=y1;b++)
|
||||
{
|
||||
gotoxy(x,b);
|
||||
cprintf("º");
|
||||
gotoxy(x1,b);
|
||||
cprintf("º");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////INFORMACION////////////////////////////////
|
||||
//HORA
|
||||
void hora()
|
||||
{
|
||||
struct time t;
|
||||
_setcursortype(_NOCURSOR);
|
||||
gettime(&t);
|
||||
gotoxy(72,25);
|
||||
textattr(47);
|
||||
cprintf("%2d:%02d:%02d",t.ti_hour, t.ti_min, t.ti_sec);
|
||||
textattr(127);
|
||||
}
|
||||
|
||||
//CREDITOS
|
||||
void creditos()
|
||||
{
|
||||
recuadro(23,10,60,14,0);
|
||||
marco(23,10,60,14);
|
||||
gotoxy(25,11);
|
||||
cprintf("PROGRAMADOR:OSCAR GANDUL ALONSO");
|
||||
gotoxy(25,12);
|
||||
cprintf("RECUERDOS A:JD,DANIEL SANDE,NICO..");
|
||||
gotoxy(25,13);
|
||||
cprintf("EL PROGRAMA ES ABURRIDO,PERO PIJO");
|
||||
while(!kbhit())
|
||||
{
|
||||
hora();
|
||||
}
|
||||
//fflush(stdin);
|
||||
textattr(LIGHTGRAY);
|
||||
recuadro(23,10,60,14,1);
|
||||
}
|
||||
|
||||
/////////////////////////////////TELEFONOS//////////////////////////////////
|
||||
//FUNCION PRINCIPAL
|
||||
void telefonos(int subopcion)
|
||||
{
|
||||
INFO *plista,*lista;
|
||||
FILE *fp;
|
||||
plista=recupera();
|
||||
switch(subopcion)
|
||||
{
|
||||
case 1:introducir(plista);break;
|
||||
case 2:contenido(plista);break;
|
||||
case 3:plista=borrar(plista);break;
|
||||
case 4:busca(plista);break;
|
||||
}
|
||||
fp=fopen("tel.dat","wb");
|
||||
lista=plista;
|
||||
while(lista->sig!=NULL)
|
||||
{
|
||||
strcpy(datos.nombre,lista->nombre);
|
||||
strcpy(datos.apodo,lista->apodo);
|
||||
strcpy(datos.numero,lista->numero);
|
||||
fwrite(&datos,sizeof(datos),1,fp);
|
||||
lista=lista->sig;
|
||||
}
|
||||
fclose(fp);
|
||||
}
|
||||
//METE DATOS
|
||||
void introducir(INFO *plista)
|
||||
{
|
||||
INFO *lista;
|
||||
lista=plista;
|
||||
recuadro(25,10,52,14,2);
|
||||
marco(25,10,52,14);
|
||||
while(lista->sig!=NULL)
|
||||
{
|
||||
lista=lista->sig;
|
||||
}
|
||||
lista->sig=(INFO *)malloc(sizeof(INFO));
|
||||
gotoxy(27,11);
|
||||
cprintf("Nombre:");
|
||||
captura(10,0,lista->nombre,34,11);
|
||||
gotoxy(27,12);
|
||||
cprintf("Apodo:");
|
||||
captura(11,0,lista->apodo,33,12);
|
||||
gotoxy(27,13);
|
||||
cprintf("Numero:");
|
||||
captura(10,0,lista->numero,34,13);
|
||||
lista=lista->sig;
|
||||
lista->sig=NULL;
|
||||
textattr(LIGHTGRAY);
|
||||
recuadro(25,10,53,15,1);
|
||||
}
|
||||
//BORRA DE LA LISTA
|
||||
INFO * borrar(INFO *plista)
|
||||
{
|
||||
int encontrado=0;
|
||||
char nombre[20],apodo[20];
|
||||
INFO *p,*pant;
|
||||
recuadro(25,10,55,14,2);
|
||||
marco(25,10,55,14);
|
||||
gotoxy(27,11);
|
||||
cprintf("Introduce nombre:");
|
||||
captura(10,0,nombre,44,11);
|
||||
gotoxy(27,12);
|
||||
cprintf("Introduce apodo:");
|
||||
captura(10,0,apodo,43,12);
|
||||
p=plista;
|
||||
pant=0;
|
||||
while(strcmp(nombre,p->nombre)!=0&&strcmp(apodo,p->apodo)!=0&&(p!=NULL))
|
||||
{
|
||||
pant=p;
|
||||
p=p->sig;
|
||||
encontrado=0;
|
||||
}
|
||||
if(strcmp(nombre,p->nombre)==0&&strcmp(apodo,p->apodo)==0)
|
||||
{
|
||||
if(pant==0) {plista=p->sig;free(p);}
|
||||
pant->sig=p->sig;
|
||||
free(p);
|
||||
encontrado=1;
|
||||
}
|
||||
if(encontrado==0) {gotoxy(27,13);cprintf("no se encontro");}
|
||||
else {gotoxy(27,13);cprintf("nombre borrado");}
|
||||
while(!kbhit())
|
||||
{
|
||||
hora();
|
||||
}
|
||||
fflush(stdin);
|
||||
textattr(7);
|
||||
recuadro(25,10,56,15,1);
|
||||
return plista;
|
||||
}
|
||||
//MUESTRA EL CONTENIDO
|
||||
void contenido(INFO *plista)
|
||||
{
|
||||
int a,c=0;
|
||||
INFO *lista;
|
||||
recuadro(2,2,79,24,0);
|
||||
marco(2,2,79,24);
|
||||
lista=plista;
|
||||
while(lista->sig!=NULL)
|
||||
{
|
||||
c++;
|
||||
gotoxy(5,c+2);
|
||||
cprintf("Nombre:%15s Apodo:%15s Numero:%15s",lista->nombre,lista->apodo,
|
||||
lista->numero);
|
||||
if(c==20)
|
||||
{
|
||||
c=0;gotoxy(37,24);printf("[PULSE TECLA]");
|
||||
while(!kbhit())
|
||||
{
|
||||
hora();
|
||||
}
|
||||
while( kbhit() ) getch();
|
||||
// fflush(stdin);
|
||||
textattr(LIGHTGRAY);
|
||||
recuadro(3,3,78,23,0);textattr(127);}
|
||||
lista=lista->sig;
|
||||
}
|
||||
while(!kbhit())
|
||||
{
|
||||
hora();
|
||||
}
|
||||
fflush(stdin);
|
||||
textattr(LIGHTGRAY);
|
||||
recuadro(2,2,79,24,1);
|
||||
}
|
||||
//BUSCA EL NOMBRE DE UNA PERSONA
|
||||
void busca(INFO *plista)
|
||||
{
|
||||
char cadena[20];
|
||||
int a,b=0,c=0;
|
||||
INFO *lista;
|
||||
lista=plista;
|
||||
recuadro(2,2,79,24,0);
|
||||
marco(2,2,79,24);
|
||||
gotoxy(4,3);
|
||||
cprintf("Nombre a buscar:");
|
||||
captura(10,0,cadena,20,3);
|
||||
while(lista->sig!=NULL)
|
||||
{
|
||||
if(c==20)
|
||||
{c=0;gotoxy(37,24);cprintf("[PULSE UNA TECLA]");
|
||||
while(!kbhit())
|
||||
{
|
||||
hora();
|
||||
}
|
||||
fflush(stdin);recuadro(2,2,79,24,0);}
|
||||
if(strcmp(cadena,lista->nombre)==0)
|
||||
{
|
||||
gotoxy(4,c+5);
|
||||
cprintf("\nApodo:%15s Numero:%15s",lista->apodo,lista->numero);
|
||||
b=1;
|
||||
c++;
|
||||
}
|
||||
lista=lista->sig;
|
||||
}
|
||||
if(b==0) {gotoxy(4,4);cprintf("Nombre no encontrado");}
|
||||
while(!kbhit())
|
||||
{
|
||||
hora();
|
||||
}
|
||||
fflush(stdin);
|
||||
textattr(7);
|
||||
recuadro(2,2,79,24,1);
|
||||
}
|
||||
//RECUPERA
|
||||
INFO * recupera()
|
||||
{
|
||||
FILE *fp;
|
||||
INFO *lista,*plista;
|
||||
fp=fopen("tel.dat","rb");
|
||||
fread(&datos,sizeof(datos),1,fp);
|
||||
lista=(INFO *)malloc(sizeof(INFO));
|
||||
plista=lista;
|
||||
strcpy(lista->nombre,datos.nombre);
|
||||
strcpy(lista->apodo,datos.apodo);
|
||||
strcpy(lista->numero,datos.numero);
|
||||
while(!feof(fp))
|
||||
{
|
||||
fread(&datos,sizeof(datos),1,fp);
|
||||
lista->sig=(INFO *)malloc(sizeof(INFO));
|
||||
lista=lista->sig;
|
||||
strcpy(lista->nombre,datos.nombre);
|
||||
strcpy(lista->apodo,datos.apodo);
|
||||
strcpy(lista->numero,datos.numero);
|
||||
}
|
||||
lista->sig=NULL;
|
||||
fclose(fp);
|
||||
return plista;
|
||||
}
|
||||
/////////////////////////////////DIARIO//////////////////////////////////////
|
||||
void diario(int subopcion)
|
||||
{
|
||||
LET *pletra;
|
||||
switch(subopcion)
|
||||
{
|
||||
case 1:pletra=introduceag();break;
|
||||
case 2:visualizaag();break;
|
||||
}
|
||||
}
|
||||
//INTRODUCE AGENDA
|
||||
LET * introduceag(void)
|
||||
{
|
||||
long int indice;
|
||||
struct date d;
|
||||
int x=3,y=3;
|
||||
char a;
|
||||
FILE *fp,*fp1;
|
||||
LET *letra,*letrant,*pletra;
|
||||
recuadro(2,2,79,24,0);
|
||||
marco(2,2,79,24);
|
||||
letra=(LET *)malloc(sizeof(LET));
|
||||
pletra=letra;
|
||||
letra->ant=NULL;
|
||||
while(a!='\x1B')
|
||||
{
|
||||
x++;
|
||||
if(x==79) {x=3;y=y+1;}
|
||||
if(x==3&&y>3&&letra->letra=='\b') {x=79;y=y-1;}
|
||||
if(y==20)
|
||||
{
|
||||
gotoxy(37,24);cprintf("[PULSE UNA TECLA]");
|
||||
while(!kbhit())
|
||||
{
|
||||
hora();
|
||||
}
|
||||
fflush(stdin);
|
||||
textattr(7);recuadro(3,3,78,23,0);textattr(127);x=3;y=3;
|
||||
}
|
||||
while(!kbhit())
|
||||
{
|
||||
hora();
|
||||
}
|
||||
a=getch();
|
||||
gotoxy(x,y);
|
||||
cprintf("%c",a);
|
||||
letra->letra=a;
|
||||
letrant=letra;
|
||||
letra->sig=(LET *)malloc(sizeof(LET));
|
||||
if(letra->letra=='\b'&&y>2&&x>3)
|
||||
{
|
||||
gotoxy(x-1,y);cprintf(" ");x=x-2;
|
||||
letra->sig=NULL;
|
||||
letra=letra->ant;
|
||||
}
|
||||
else if(letra->letra=='\b'&&y>2&&x==3) {x=2;}
|
||||
else {
|
||||
letra=letra->sig;
|
||||
letra->ant=letrant;
|
||||
}
|
||||
}
|
||||
letra->sig=NULL;
|
||||
textattr(7);
|
||||
recuadro(2,2,79,24,1);
|
||||
fp=fopen("agenda.dat","ab");
|
||||
fp1=fopen("indiceag.dat","ab");
|
||||
letra=pletra;
|
||||
getdate(&d);
|
||||
indice=ftell(fp);
|
||||
fwrite(&d,sizeof(d),1,fp1);
|
||||
fwrite(&indice,sizeof(long int),1,fp1);
|
||||
fwrite(&d,sizeof(d),1,fp);
|
||||
while(letra->sig!=NULL)
|
||||
{
|
||||
simbolo.letra=letra->letra;
|
||||
fwrite(&simbolo.letra,sizeof(simbolo),1,fp);
|
||||
letra=letra->sig;
|
||||
}
|
||||
fclose(fp);
|
||||
fclose(fp1);
|
||||
return pletra;
|
||||
}
|
||||
//VISUALIZA AGENDA
|
||||
void visualizaag(void)
|
||||
{
|
||||
char pegote[10];
|
||||
struct date d;
|
||||
long int indice;
|
||||
int dia,mes,ano;
|
||||
long int longitud;
|
||||
int x=3,y=4,encontrado=0;
|
||||
FILE *fp,*fp1;
|
||||
LET *letra,*pletra,*letrant;
|
||||
recuadro(2,2,79,24,0);
|
||||
marco(2,2,79,24);
|
||||
gotoxy(4,3);
|
||||
cprintf("Dia:");
|
||||
captura(2,1,pegote,8,3);
|
||||
dia=matriz1;
|
||||
gotoxy(14,3);
|
||||
cprintf("Mes:");
|
||||
captura(2,1,pegote,18,3);
|
||||
mes=matriz1;
|
||||
gotoxy(24,3);
|
||||
cprintf("A¤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);
|
||||
|
||||
}*/
|
1
AGENDA.DAT
Normal file
1
AGENDA.DAT
Normal file
@ -0,0 +1 @@
|
||||
<EFBFBD>
|
BIN
AGENDA.EXE
Normal file
BIN
AGENDA.EXE
Normal file
Binary file not shown.
BIN
AGENDA.PIF
Normal file
BIN
AGENDA.PIF
Normal file
Binary file not shown.
851
AGENDA1.CPP
Normal file
851
AGENDA1.CPP
Normal file
@ -0,0 +1,851 @@
|
||||
//BIBLIOTECAS EMPLEADAS
|
||||
//Bibliotecas
|
||||
#include<math.h>
|
||||
#include<ctype.h>
|
||||
#include<alloc.h>
|
||||
#include<string.h>
|
||||
#include<dos.h>
|
||||
#include<stdio.h>
|
||||
#include<bios.h>
|
||||
#include<conio.h>
|
||||
|
||||
//VARIABLES GLOBALES
|
||||
struct datos{ char nombre[20];
|
||||
char apodo[20];
|
||||
char numero[20];
|
||||
|
||||
}datos;
|
||||
|
||||
typedef struct nodo{ char nombre[20];
|
||||
char apodo[20];
|
||||
char numero[20];
|
||||
struct nodo *sig;
|
||||
}INFO;
|
||||
|
||||
struct simbolo{ char letra;
|
||||
|
||||
}simbolo;
|
||||
|
||||
typedef struct nodo1{ char letra;
|
||||
struct nodo1 *sig;
|
||||
struct nodo1 *ant;
|
||||
|
||||
}LET;
|
||||
int matriz1;
|
||||
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;a<y1+2;a++)
|
||||
{
|
||||
gotoxy(x1+1,a);
|
||||
cprintf("Û");
|
||||
}
|
||||
for(a=x+1;a<x1+1;a++)
|
||||
{
|
||||
gotoxy(a,y1+1);
|
||||
cprintf("Û");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//FUNCION PARA ENMARCAR UN RECUADRO
|
||||
void marco(int x,int y,int x1,int y1)
|
||||
{
|
||||
int a,b;
|
||||
textattr(127);
|
||||
gotoxy(x,y);
|
||||
cprintf("É");
|
||||
gotoxy(x,y1);
|
||||
cprintf("È");
|
||||
gotoxy(x1,y);
|
||||
cprintf("»");
|
||||
gotoxy(x1,y1);
|
||||
cprintf("¼");
|
||||
|
||||
for(a=x+1;a!=x1;a++)
|
||||
{
|
||||
gotoxy(a,y);
|
||||
cprintf("Í");
|
||||
gotoxy(a,y1);
|
||||
cprintf("Í");
|
||||
|
||||
}
|
||||
|
||||
for(b=y+1;b!=y1;b++)
|
||||
{
|
||||
gotoxy(x,b);
|
||||
cprintf("º");
|
||||
gotoxy(x1,b);
|
||||
cprintf("º");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////INFORMACION////////////////////////////////
|
||||
//HORA
|
||||
void hora()
|
||||
{
|
||||
struct time t;
|
||||
_setcursortype(_NOCURSOR);
|
||||
gettime(&t);
|
||||
gotoxy(72,25);
|
||||
textattr(47);
|
||||
cprintf("%2d:%02d:%02d",t.ti_hour, t.ti_min, t.ti_sec);
|
||||
textattr(127);
|
||||
}
|
||||
|
||||
//CREDITOS
|
||||
void creditos()
|
||||
{
|
||||
recuadro(23,10,60,14,0);
|
||||
marco(23,10,60,14);
|
||||
gotoxy(25,11);
|
||||
cprintf("PROGRAMADOR:OSCAR GANDUL ALONSO");
|
||||
gotoxy(25,12);
|
||||
cprintf("RECUERDOS A:JD,DANIEL SANDE,NICO..");
|
||||
gotoxy(25,13);
|
||||
cprintf("EL PROGRAMA ES ABURRIDO,PERO PIJO");
|
||||
while(!kbhit())
|
||||
{
|
||||
hora();
|
||||
}
|
||||
//fflush(stdin);
|
||||
textattr(LIGHTGRAY);
|
||||
recuadro(23,10,60,14,1);
|
||||
}
|
||||
|
||||
/////////////////////////////////TELEFONOS//////////////////////////////////
|
||||
//FUNCION PRINCIPAL
|
||||
void telefonos(int subopcion)
|
||||
{
|
||||
switch(subopcion)
|
||||
{
|
||||
case 1:introducir();break;
|
||||
case 2:contenido();break;
|
||||
case 3:borrar();break;
|
||||
case 4:busca();break;
|
||||
}
|
||||
}
|
||||
//METE DATOS
|
||||
void introducir()
|
||||
{
|
||||
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
|
||||
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);
|
||||
}
|
BIN
AGENDA1.EXE
Normal file
BIN
AGENDA1.EXE
Normal file
Binary file not shown.
101
AHORCADO.CPP
Normal file
101
AHORCADO.CPP
Normal file
@ -0,0 +1,101 @@
|
||||
|
||||
#include<stdio.h>
|
||||
#include<conio.h>
|
||||
#include<string.h>
|
||||
#include<stdlib.h>
|
||||
|
||||
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<l;i++)
|
||||
{
|
||||
gotoxy(i+1,10);
|
||||
cprintf("_");
|
||||
}
|
||||
while((c2<5)&&(c1!=l))
|
||||
{
|
||||
textcolor(2);
|
||||
gotoxy(1,11);
|
||||
cprintf("\nintroduzca letra:");
|
||||
scanf("%c",&pala);
|
||||
getchar();
|
||||
gotoxy(17,12);
|
||||
cprintf(" ");
|
||||
textcolor(5);
|
||||
for(i=0;i<l;i++)
|
||||
if(pala==palabra[x][i])
|
||||
{
|
||||
c1++;
|
||||
gotoxy(i+1,10);
|
||||
cprintf("%c",palabra[x][i]);
|
||||
palabra[x][i]=0;
|
||||
}
|
||||
|
||||
if(c1a==c1)
|
||||
{
|
||||
c2++;
|
||||
dibujo(c2);
|
||||
}
|
||||
|
||||
c1a=c1;
|
||||
|
||||
}
|
||||
gotoxy(1,15);
|
||||
if(c1==l)
|
||||
printf("enhorabuena");
|
||||
else
|
||||
printf("nada chaval");
|
||||
getch();
|
||||
}
|
BIN
Agenda C++/Agendas.exe
Normal file
BIN
Agenda C++/Agendas.exe
Normal file
Binary file not shown.
21
Agenda C++/LISTA.TXT
Normal file
21
Agenda C++/LISTA.TXT
Normal file
@ -0,0 +1,21 @@
|
||||
PINBALL-|-----EPIC PINBALL(12) 10
|
||||
|-----SILVER PINBALL 6
|
||||
|-----FANTASY PINBALL 10
|
||||
|
||||
CONSOLAS-|----SNES 50
|
||||
|----PCENGINE 50
|
||||
|----MEGADRIVE 50
|
||||
|
||||
JUEGOS---|----DESCENT 10
|
||||
|----ToShiDen 16
|
||||
|----QUAKE 30
|
||||
|----DUKENUKEM 30
|
||||
|----SYNDICATE 20
|
||||
|----SCREAMER 20
|
||||
|----destruction DERBY 16
|
||||
|----FIFA 98 1??
|
||||
|
||||
UTILIDAD-|----PARTITION MAGIC 65
|
||||
|----BUILDER C++ 250
|
||||
|----DEMOS GUAPAS ????
|
||||
|
BIN
Agenda C++/Recordatorio.db
Normal file
BIN
Agenda C++/Recordatorio.db
Normal file
Binary file not shown.
BIN
Agenda C++/agenda.DB
Normal file
BIN
Agenda C++/agenda.DB
Normal file
Binary file not shown.
BIN
Agenda C++/agenda.MB
Normal file
BIN
Agenda C++/agenda.MB
Normal file
Binary file not shown.
BIN
Agenda C++/agenda.PX
Normal file
BIN
Agenda C++/agenda.PX
Normal file
Binary file not shown.
BIN
Agenda C++/recordatorio.px
Normal file
BIN
Agenda C++/recordatorio.px
Normal file
Binary file not shown.
BIN
Agenda C++/telefonos.db
Normal file
BIN
Agenda C++/telefonos.db
Normal file
Binary file not shown.
BIN
Agenda C++/telefonos.px
Normal file
BIN
Agenda C++/telefonos.px
Normal file
Binary file not shown.
131
Builder/agenda/Agenda.cpp
Normal file
131
Builder/agenda/Agenda.cpp
Normal file
@ -0,0 +1,131 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#include <vcl\vcl.h>
|
||||
#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;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
BIN
Builder/agenda/Agenda.dfm
Normal file
BIN
Builder/agenda/Agenda.dfm
Normal file
Binary file not shown.
66
Builder/agenda/Agenda.h
Normal file
66
Builder/agenda/Agenda.h
Normal file
@ -0,0 +1,66 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#ifndef AgendaH
|
||||
#define AgendaH
|
||||
//---------------------------------------------------------------------------
|
||||
#include <vcl\Classes.hpp>
|
||||
#include <vcl\Controls.hpp>
|
||||
#include <vcl\StdCtrls.hpp>
|
||||
#include <vcl\Forms.hpp>
|
||||
#include <vcl\Menus.hpp>
|
||||
#include <vcl\ExtCtrls.hpp>
|
||||
#include <vcl\DBGrids.hpp>
|
||||
#include "Grids.hpp"
|
||||
#include <vcl\DB.hpp>
|
||||
#include <vcl\DBTables.hpp>
|
||||
#include <Db.hpp>
|
||||
//---------------------------------------------------------------------------
|
||||
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
|
28
Builder/agenda/Agendas.cpp
Normal file
28
Builder/agenda/Agendas.cpp
Normal file
@ -0,0 +1,28 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#include <vcl\vcl.h>
|
||||
#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;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
144
Builder/agenda/Agendas.dsk
Normal file
144
Builder/agenda/Agendas.dsk
Normal file
@ -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
|
||||
|
BIN
Builder/agenda/Agendas.exe
Normal file
BIN
Builder/agenda/Agendas.exe
Normal file
Binary file not shown.
94
Builder/agenda/Agendas.mak
Normal file
94
Builder/agenda/Agendas.mak
Normal file
@ -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) $<
|
||||
#-----------------------------------------------------------------------------
|
BIN
Builder/agenda/Agendas.res
Normal file
BIN
Builder/agenda/Agendas.res
Normal file
Binary file not shown.
55
Builder/agenda/RS.mak
Normal file
55
Builder/agenda/RS.mak
Normal file
@ -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) $<
|
||||
#-----------------------------------------------------------------------------
|
BIN
Builder/agenda/Recordatorio.PX
Normal file
BIN
Builder/agenda/Recordatorio.PX
Normal file
Binary file not shown.
BIN
Builder/agenda/Recordatorio.VAL
Normal file
BIN
Builder/agenda/Recordatorio.VAL
Normal file
Binary file not shown.
BIN
Builder/agenda/Recordatorio.db
Normal file
BIN
Builder/agenda/Recordatorio.db
Normal file
Binary file not shown.
85
Builder/agenda/Recuerda.cpp
Normal file
85
Builder/agenda/Recuerda.cpp
Normal file
@ -0,0 +1,85 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#include <vcl\vcl.h>
|
||||
#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();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
BIN
Builder/agenda/Recuerda.dfm
Normal file
BIN
Builder/agenda/Recuerda.dfm
Normal file
Binary file not shown.
52
Builder/agenda/Recuerda.h
Normal file
52
Builder/agenda/Recuerda.h
Normal file
@ -0,0 +1,52 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#ifndef RecuerdaH
|
||||
#define RecuerdaH
|
||||
//---------------------------------------------------------------------------
|
||||
#include <vcl\Classes.hpp>
|
||||
#include <vcl\Controls.hpp>
|
||||
#include <vcl\StdCtrls.hpp>
|
||||
#include <vcl\Forms.hpp>
|
||||
#include <vcl\DBCtrls.hpp>
|
||||
#include <vcl\Mask.hpp>
|
||||
#include <vcl\DB.hpp>
|
||||
#include <vcl\DBTables.hpp>
|
||||
#include <vcl\ExtCtrls.hpp>
|
||||
#include <Db.hpp>
|
||||
//---------------------------------------------------------------------------
|
||||
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
|
BIN
Builder/agenda/agenda.MB
Normal file
BIN
Builder/agenda/agenda.MB
Normal file
Binary file not shown.
BIN
Builder/agenda/agenda.PX
Normal file
BIN
Builder/agenda/agenda.PX
Normal file
Binary file not shown.
BIN
Builder/agenda/agenda.db
Normal file
BIN
Builder/agenda/agenda.db
Normal file
Binary file not shown.
41
Builder/agenda/bdiario.cpp
Normal file
41
Builder/agenda/bdiario.cpp
Normal file
@ -0,0 +1,41 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#include <vcl\vcl.h>
|
||||
#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");
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
BIN
Builder/agenda/bdiario.dfm
Normal file
BIN
Builder/agenda/bdiario.dfm
Normal file
Binary file not shown.
38
Builder/agenda/bdiario.h
Normal file
38
Builder/agenda/bdiario.h
Normal file
@ -0,0 +1,38 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#ifndef bdiarioH
|
||||
#define bdiarioH
|
||||
//---------------------------------------------------------------------------
|
||||
#include <vcl\Classes.hpp>
|
||||
#include <vcl\Controls.hpp>
|
||||
#include <vcl\StdCtrls.hpp>
|
||||
#include <vcl\Forms.hpp>
|
||||
#include <vcl\ExtCtrls.hpp>
|
||||
#include <vcl\DBCtrls.hpp>
|
||||
#include <vcl\DB.hpp>
|
||||
#include <vcl\DBTables.hpp>
|
||||
#include <vcl\Mask.hpp>
|
||||
//---------------------------------------------------------------------------
|
||||
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
|
82
Builder/agenda/busqueda.cpp
Normal file
82
Builder/agenda/busqueda.cpp
Normal file
@ -0,0 +1,82 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#include <vcl\vcl.h>
|
||||
#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;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
BIN
Builder/agenda/busqueda.dfm
Normal file
BIN
Builder/agenda/busqueda.dfm
Normal file
Binary file not shown.
43
Builder/agenda/busqueda.h
Normal file
43
Builder/agenda/busqueda.h
Normal file
@ -0,0 +1,43 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#ifndef busquedaH
|
||||
#define busquedaH
|
||||
//---------------------------------------------------------------------------
|
||||
#include <vcl\Classes.hpp>
|
||||
#include <vcl\Controls.hpp>
|
||||
#include <vcl\StdCtrls.hpp>
|
||||
#include <vcl\Forms.hpp>
|
||||
#include <vcl\DBGrids.hpp>
|
||||
#include "Grids.hpp"
|
||||
#include <vcl\DB.hpp>
|
||||
#include <vcl\DBTables.hpp>
|
||||
//---------------------------------------------------------------------------
|
||||
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
|
3
Builder/agenda/cleanup.bat
Normal file
3
Builder/agenda/cleanup.bat
Normal file
@ -0,0 +1,3 @@
|
||||
del *.~*
|
||||
del *.tds
|
||||
del *.obj
|
93
Builder/agenda/diario.cpp
Normal file
93
Builder/agenda/diario.cpp
Normal file
@ -0,0 +1,93 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#include <vcl\vcl.h>
|
||||
#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();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
BIN
Builder/agenda/diario.dfm
Normal file
BIN
Builder/agenda/diario.dfm
Normal file
Binary file not shown.
58
Builder/agenda/diario.h
Normal file
58
Builder/agenda/diario.h
Normal file
@ -0,0 +1,58 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#ifndef diarioH
|
||||
#define diarioH
|
||||
//---------------------------------------------------------------------------
|
||||
#include <vcl\Classes.hpp>
|
||||
#include <vcl\Controls.hpp>
|
||||
#include <vcl\StdCtrls.hpp>
|
||||
#include <vcl\Forms.hpp>
|
||||
#include <vcl\ExtCtrls.hpp>
|
||||
#include <vcl\DBCtrls.hpp>
|
||||
#include <vcl\DBTables.hpp>
|
||||
#include <vcl\DB.hpp>
|
||||
#include <vcl\Mask.hpp>
|
||||
#include <Db.hpp>
|
||||
//---------------------------------------------------------------------------
|
||||
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
|
17
Builder/agenda/listado.cpp
Normal file
17
Builder/agenda/listado.cpp
Normal file
@ -0,0 +1,17 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#include <vcl\vcl.h>
|
||||
#pragma hdrstop
|
||||
|
||||
#include "telefonos.h"
|
||||
#include "listado.h"
|
||||
//---------------------------------------------------------------------------
|
||||
#pragma link "Grids"
|
||||
#pragma resource "*.dfm"
|
||||
TForm5 *Form5;
|
||||
//---------------------------------------------------------------------------
|
||||
__fastcall TForm5::TForm5(TComponent* Owner)
|
||||
: TForm(Owner)
|
||||
{
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
|
BIN
Builder/agenda/listado.dfm
Normal file
BIN
Builder/agenda/listado.dfm
Normal file
Binary file not shown.
30
Builder/agenda/listado.h
Normal file
30
Builder/agenda/listado.h
Normal file
@ -0,0 +1,30 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#ifndef listadoH
|
||||
#define listadoH
|
||||
//---------------------------------------------------------------------------
|
||||
#include <vcl\Classes.hpp>
|
||||
#include <vcl\Controls.hpp>
|
||||
#include <vcl\StdCtrls.hpp>
|
||||
#include <vcl\Forms.hpp>
|
||||
#include <vcl\ExtCtrls.hpp>
|
||||
#include <vcl\DBGrids.hpp>
|
||||
#include "Grids.hpp"
|
||||
#include <vcl\DB.hpp>
|
||||
#include <vcl\DBTables.hpp>
|
||||
//---------------------------------------------------------------------------
|
||||
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
|
BIN
Builder/agenda/telefonos.PX
Normal file
BIN
Builder/agenda/telefonos.PX
Normal file
Binary file not shown.
BIN
Builder/agenda/telefonos.VAL
Normal file
BIN
Builder/agenda/telefonos.VAL
Normal file
Binary file not shown.
82
Builder/agenda/telefonos.cpp
Normal file
82
Builder/agenda/telefonos.cpp
Normal file
@ -0,0 +1,82 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#include <vcl\vcl.h>
|
||||
#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();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
BIN
Builder/agenda/telefonos.db
Normal file
BIN
Builder/agenda/telefonos.db
Normal file
Binary file not shown.
BIN
Builder/agenda/telefonos.dfm
Normal file
BIN
Builder/agenda/telefonos.dfm
Normal file
Binary file not shown.
69
Builder/agenda/telefonos.h
Normal file
69
Builder/agenda/telefonos.h
Normal file
@ -0,0 +1,69 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#ifndef telefonosH
|
||||
#define telefonosH
|
||||
//---------------------------------------------------------------------------
|
||||
#include <vcl\Classes.hpp>
|
||||
#include <vcl\Controls.hpp>
|
||||
#include <vcl\StdCtrls.hpp>
|
||||
#include <vcl\Forms.hpp>
|
||||
#include <vcl\ExtCtrls.hpp>
|
||||
#include <vcl\DB.hpp>
|
||||
#include <vcl\DBTables.hpp>
|
||||
#include <vcl\DBCtrls.hpp>
|
||||
#include <vcl\Mask.hpp>
|
||||
#include <Db.hpp>
|
||||
//---------------------------------------------------------------------------
|
||||
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
|
BIN
Builder/barmatic/Repartidores.db
Normal file
BIN
Builder/barmatic/Repartidores.db
Normal file
Binary file not shown.
BIN
Builder/barmatic/articulo.DB
Normal file
BIN
Builder/barmatic/articulo.DB
Normal file
Binary file not shown.
66
Builder/barmatic/articulos.cpp
Normal file
66
Builder/barmatic/articulos.cpp
Normal file
@ -0,0 +1,66 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#include <vcl\vcl.h>
|
||||
#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;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
BIN
Builder/barmatic/articulos.dfm
Normal file
BIN
Builder/barmatic/articulos.dfm
Normal file
Binary file not shown.
75
Builder/barmatic/articulos.h
Normal file
75
Builder/barmatic/articulos.h
Normal file
@ -0,0 +1,75 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#ifndef articulosH
|
||||
#define articulosH
|
||||
//---------------------------------------------------------------------------
|
||||
#include <vcl\Classes.hpp>
|
||||
#include <vcl\Controls.hpp>
|
||||
#include <vcl\StdCtrls.hpp>
|
||||
#include <vcl\Forms.hpp>
|
||||
#include <vcl\ExtCtrls.hpp>
|
||||
#include <vcl\DB.hpp>
|
||||
#include <vcl\DBTables.hpp>
|
||||
#include <vcl\DBCtrls.hpp>
|
||||
#include <vcl\Mask.hpp>
|
||||
//---------------------------------------------------------------------------
|
||||
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
|
84
Builder/barmatic/barmati.cpp
Normal file
84
Builder/barmatic/barmati.cpp
Normal file
@ -0,0 +1,84 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#include <vcl\vcl.h>
|
||||
#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;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
BIN
Builder/barmatic/barmati.dfm
Normal file
BIN
Builder/barmatic/barmati.dfm
Normal file
Binary file not shown.
78
Builder/barmatic/barmati.h
Normal file
78
Builder/barmatic/barmati.h
Normal file
@ -0,0 +1,78 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#ifndef barmatiH
|
||||
#define barmatiH
|
||||
//---------------------------------------------------------------------------
|
||||
#include <vcl\Classes.hpp>
|
||||
#include <vcl\Controls.hpp>
|
||||
#include <vcl\StdCtrls.hpp>
|
||||
#include <vcl\Forms.hpp>
|
||||
#include <vcl\Menus.hpp>
|
||||
#include <vcl\ExtCtrls.hpp>
|
||||
#include <vcl\DBTables.hpp>
|
||||
#include <vcl\DB.hpp>
|
||||
//---------------------------------------------------------------------------
|
||||
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
|
30
Builder/barmatic/barmatic.cpp
Normal file
30
Builder/barmatic/barmatic.cpp
Normal file
@ -0,0 +1,30 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#include <vcl\vcl.h>
|
||||
#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;
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
59
Builder/barmatic/barmatic.mak
Normal file
59
Builder/barmatic/barmatic.mak
Normal file
@ -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) $<
|
||||
#-----------------------------------------------------------------------------
|
BIN
Builder/barmatic/barmatic.res
Normal file
BIN
Builder/barmatic/barmatic.res
Normal file
Binary file not shown.
45
Builder/barmatic/claves.cpp
Normal file
45
Builder/barmatic/claves.cpp
Normal file
@ -0,0 +1,45 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#include <vcl\vcl.h>
|
||||
#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;
|
||||
}
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
BIN
Builder/barmatic/claves.dfm
Normal file
BIN
Builder/barmatic/claves.dfm
Normal file
Binary file not shown.
28
Builder/barmatic/claves.h
Normal file
28
Builder/barmatic/claves.h
Normal file
@ -0,0 +1,28 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#ifndef clavesH
|
||||
#define clavesH
|
||||
//---------------------------------------------------------------------------
|
||||
#include <vcl\Classes.hpp>
|
||||
#include <vcl\Controls.hpp>
|
||||
#include <vcl\StdCtrls.hpp>
|
||||
#include <vcl\Forms.hpp>
|
||||
#include <vcl\ExtCtrls.hpp>
|
||||
//---------------------------------------------------------------------------
|
||||
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
|
BIN
Builder/barmatic/clientes.db
Normal file
BIN
Builder/barmatic/clientes.db
Normal file
Binary file not shown.
15
Builder/barmatic/listado.cpp
Normal file
15
Builder/barmatic/listado.cpp
Normal file
@ -0,0 +1,15 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#include <vcl\vcl.h>
|
||||
#pragma hdrstop
|
||||
|
||||
#include "listado.h"
|
||||
//---------------------------------------------------------------------------
|
||||
#pragma link "Grids"
|
||||
#pragma resource "*.dfm"
|
||||
TForm3 *Form3;
|
||||
//---------------------------------------------------------------------------
|
||||
__fastcall TForm3::TForm3(TComponent* Owner)
|
||||
: TForm(Owner)
|
||||
{
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
BIN
Builder/barmatic/listado.dfm
Normal file
BIN
Builder/barmatic/listado.dfm
Normal file
Binary file not shown.
33
Builder/barmatic/listado.h
Normal file
33
Builder/barmatic/listado.h
Normal file
@ -0,0 +1,33 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#ifndef listadoH
|
||||
#define listadoH
|
||||
//---------------------------------------------------------------------------
|
||||
#include <vcl\Classes.hpp>
|
||||
#include <vcl\Controls.hpp>
|
||||
#include <vcl\StdCtrls.hpp>
|
||||
#include <vcl\Forms.hpp>
|
||||
#include <vcl\DBGrids.hpp>
|
||||
#include "Grids.hpp"
|
||||
#include <vcl\DB.hpp>
|
||||
#include <vcl\DBTables.hpp>
|
||||
#include <vcl\QuickRep.hpp>
|
||||
//---------------------------------------------------------------------------
|
||||
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
|
33
Builder/barmatic/repartidores.cpp
Normal file
33
Builder/barmatic/repartidores.cpp
Normal file
@ -0,0 +1,33 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#include <vcl\vcl.h>
|
||||
#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();
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
BIN
Builder/barmatic/repartidores.dfm
Normal file
BIN
Builder/barmatic/repartidores.dfm
Normal file
Binary file not shown.
41
Builder/barmatic/repartidores.h
Normal file
41
Builder/barmatic/repartidores.h
Normal file
@ -0,0 +1,41 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#ifndef repartidoresH
|
||||
#define repartidoresH
|
||||
//---------------------------------------------------------------------------
|
||||
#include <vcl\Classes.hpp>
|
||||
#include <vcl\Controls.hpp>
|
||||
#include <vcl\StdCtrls.hpp>
|
||||
#include <vcl\Forms.hpp>
|
||||
#include <vcl\ExtCtrls.hpp>
|
||||
#include <vcl\DBTables.hpp>
|
||||
#include <vcl\DB.hpp>
|
||||
#include <vcl\DBCtrls.hpp>
|
||||
#include <vcl\Mask.hpp>
|
||||
//---------------------------------------------------------------------------
|
||||
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
|
885
C.CPP
Normal file
885
C.CPP
Normal file
@ -0,0 +1,885 @@
|
||||
//PROYECTO DE PROGRAMACION
|
||||
//BIBLIOTECAS EMPLEADAS
|
||||
#include<stdio.h>
|
||||
#include<bios.h>
|
||||
#include<conio.h>
|
||||
#include<string.h>
|
||||
#include<ctype.h>
|
||||
//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<y1+2;a++)
|
||||
{
|
||||
gotoxy(x1+1,a);
|
||||
cprintf("Û");
|
||||
}
|
||||
for(a=x+1;a<x1+1;a++)
|
||||
{
|
||||
gotoxy(a,y1+1);
|
||||
cprintf("Û");
|
||||
}
|
||||
}
|
||||
}
|
||||
/////////////////////////////FUNCION DE ALUMNOS//////////////////////////////
|
||||
void alumnos(int subopcion,int subopcion1,int subopcion2)
|
||||
{
|
||||
//OPCION cap;
|
||||
char nombre[9],nombreb[20];
|
||||
int y=0;
|
||||
int o,i;
|
||||
FILE *eso3a,*eso3b,*eso4a,*eso4b,*bcn1a,*bcn1b,*bcn2a,*bcn2b;
|
||||
FILE *cfgs1a,*cfgs1b,*cfgs2;
|
||||
ALUMNO_E3 reg;ALUMNO_E3 busca;
|
||||
ALUMNO_E4 reg1;ALUMNO_E4 busca1;
|
||||
ALUMNO_B1 reg2;ALUMNO_B1 busca2;
|
||||
ALUMNO_B2 reg3;ALUMNO_B2 busca3;
|
||||
ALUMNO_C1 reg4;ALUMNO_C1 busca4;
|
||||
ALUMNO_C2 reg5;ALUMNO_C2 busca5;
|
||||
eso3a=fopen("eso3a.dat","a+b");
|
||||
eso3b=fopen("eso3b.dat","a+b");
|
||||
eso4a=fopen("eso4a.dat","a+b");
|
||||
eso4b=fopen("eso4b.dat","a+b");
|
||||
bcn1a=fopen("bcn1a.dat","a+b");
|
||||
bcn1b=fopen("bcn1b.dat","a+b");
|
||||
bcn2a=fopen("bcn2a.dat","a+b");
|
||||
bcn2b=fopen("bcn2b.dat","a+b");
|
||||
cfgs1a=fopen("cfgs1a.dat","a+b");
|
||||
cfgs1b=fopen("cfgs1b.dat","a+b");
|
||||
cfgs2=fopen("cfgs2.dat","a+b");
|
||||
recuadro(16,3,40,23,2);
|
||||
textattr(127);
|
||||
gotoxy(17,3);
|
||||
cprintf("NOMBRE:");
|
||||
gotoxy(24,3);
|
||||
captura(9,'c',cap,nombre);
|
||||
strcpy(reg.nombre_alumno,nombre);
|
||||
strcpy(reg1.nombre_alumno,nombre);
|
||||
strcpy(reg2.nombre_alumno,nombre);
|
||||
strcpy(reg3.nombre_alumno,nombre);
|
||||
strcpy(reg4.nombre_alumno,nombre);
|
||||
strcpy(reg5.nombre_alumno,nombre);
|
||||
if(subopcion2==1) //mete datos
|
||||
{
|
||||
switch(subopcion) //dibuja asignaturas
|
||||
{
|
||||
case 1://ALUMNOS DE ESO
|
||||
if(subopcion1==1||subopcion1==2)
|
||||
{
|
||||
for(y=6;y<22;y++)
|
||||
{
|
||||
gotoxy(19,y);
|
||||
if(y<13) cprintf("%s:",ESO3[y-6]);
|
||||
else if(y<15) cprintf("%i.-%s:",y-12,ESO3[y-6]);
|
||||
else if(y<17) cprintf("%i.-%s:",y-14,ESO3[y-6]);
|
||||
else cprintf("%i.-%s:",y-16,ESO3[y-6]);
|
||||
}
|
||||
}
|
||||
else
|
||||
for(y=4;y<24;y++)
|
||||
{
|
||||
gotoxy(19,y);
|
||||
if(y<8) cprintf("%s:",ESO4[y-4]);
|
||||
else if(y<13) cprintf("%i.-%s:",y-7,ESO4[y-4]);
|
||||
else if(y<15) cprintf("%i.-%s:",y-12,ESO4[y-4]);
|
||||
else if(y<17) cprintf("%i.-%s:",y-14,ESO4[y-4]);
|
||||
else cprintf("%i.-%s:",y-16,ESO4[y-4]);
|
||||
}
|
||||
|
||||
break;
|
||||
case 2://ALUMNOS DE BCN
|
||||
if(subopcion1==1||subopcion1==2)
|
||||
{
|
||||
for(y=7;y<22;y++)
|
||||
{
|
||||
gotoxy(19,y);
|
||||
if(y<13) cprintf("%s:",BCN1[y-7]);
|
||||
else if(y<15) cprintf("%i.-%s:",y-12,BCN1[y-7]);
|
||||
else if(y<17) cprintf("%i.-%s:",y-14,BCN1[y-7]);
|
||||
else cprintf("%i.-%s:",y-16,BCN1[y-7]);
|
||||
}
|
||||
}
|
||||
else
|
||||
for(y=5;y<23;y++)
|
||||
{
|
||||
gotoxy(19,y);
|
||||
if(y<7) cprintf("%s:",BCN2[y-5]);
|
||||
else if(y<9) cprintf("%i.-%s:",y-6,BCN2[y-5]);
|
||||
else if(y<11) cprintf("%i.-%s:",y-8,BCN2[y-5]);
|
||||
else if(y<13) cprintf("%i.-%s:",y-10,BCN2[y-5]);
|
||||
else cprintf("%i.-%s:",y-12,BCN2[y-5]);
|
||||
}
|
||||
|
||||
break;
|
||||
case 3://ALUMNOS DE CFGS
|
||||
if(subopcion1==1||subopcion1==2)
|
||||
{
|
||||
for(y=12;y<16;y++)
|
||||
{
|
||||
gotoxy(19,y);cprintf("%s:",CFGS1[y-12]);
|
||||
}
|
||||
}
|
||||
else
|
||||
for(y=11;y<16;y++)
|
||||
{
|
||||
gotoxy(19,y);cprintf("%s:",CFGS2[y-11]);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
//METE DATOS
|
||||
gotoxy(2,25);
|
||||
cprintf("RETURN[Asignatura Obligatoria],ESPACIO[Asignatura Convalidada]");
|
||||
switch(subopcion)
|
||||
{
|
||||
case 1://ALUMNOS DE ESO
|
||||
switch(subopcion1)
|
||||
{
|
||||
case 1:
|
||||
for(y=6;y<22;y++)
|
||||
{
|
||||
if(y<13) gotoxy(22,y);
|
||||
else gotoxy(25,y);
|
||||
o=bioskey(0);
|
||||
if(o==14624)
|
||||
{
|
||||
cprintf("AV");
|
||||
strcpy(reg.estado_asig[y-6],"AV");
|
||||
}
|
||||
if(o==7181)
|
||||
{
|
||||
cprintf("AO");
|
||||
strcpy(reg.estado_asig[y-6],"AO");
|
||||
}
|
||||
strcpy(reg.nombre_asig[y-6],ESO3[y-6]);
|
||||
}
|
||||
fwrite(®,sizeof(ALUMNO_E3),1,eso3a);
|
||||
break;
|
||||
case 2:
|
||||
for(y=6;y<22;y++)
|
||||
{
|
||||
if(y<13) gotoxy(22,y);
|
||||
else gotoxy(25,y);
|
||||
o=bioskey(0);
|
||||
if(o==14624)
|
||||
{
|
||||
cprintf("AV");
|
||||
strcpy(reg.estado_asig[y-6],"AV");
|
||||
}
|
||||
if(o==7181)
|
||||
{
|
||||
cprintf("AO");
|
||||
strcpy(reg.estado_asig[y-6],"AO");
|
||||
}
|
||||
strcpy(reg.nombre_asig[y-6],ESO3[y-6]);
|
||||
}
|
||||
fwrite(®,sizeof(ALUMNO_E3),1,eso3b);
|
||||
break;
|
||||
case 3:
|
||||
for(y=4;y<24;y++)
|
||||
{
|
||||
if(y<8) gotoxy(22,y);
|
||||
else gotoxy(25,y);
|
||||
o=bioskey(0);
|
||||
if(o==14624)
|
||||
{
|
||||
cprintf("AV");
|
||||
strcpy(reg1.estado_asig[y-4],"AV");
|
||||
}
|
||||
if(o==7181)
|
||||
{
|
||||
cprintf("AO");
|
||||
strcpy(reg1.estado_asig[y-4],"AO");
|
||||
}
|
||||
strcpy(reg1.nombre_asig[y-4],ESO4[y-4]);
|
||||
}
|
||||
fwrite(®1,sizeof(ALUMNO_E4),1,eso4a);
|
||||
break;
|
||||
case 4:
|
||||
for(y=4;y<24;y++)
|
||||
{
|
||||
if(y<8) gotoxy(22,y);
|
||||
else gotoxy(25,y);
|
||||
o=bioskey(0);
|
||||
if(o==14624)
|
||||
{
|
||||
cprintf("AV");
|
||||
strcpy(reg1.estado_asig[y-4],"AV");
|
||||
}
|
||||
if(o==7181)
|
||||
{
|
||||
cprintf("AO");
|
||||
strcpy(reg1.estado_asig[y-4],"AO");
|
||||
}
|
||||
strcpy(reg1.nombre_asig[y-4],ESO4[y-4]);
|
||||
}
|
||||
fwrite(®1,sizeof(ALUMNO_E4),1,eso4b);
|
||||
}
|
||||
break;
|
||||
case 2://ALUMNOS DE BCN
|
||||
switch(subopcion1)
|
||||
{
|
||||
case 1:
|
||||
for(y=7;y<22;y++)
|
||||
{
|
||||
if(y<13) gotoxy(22,y);
|
||||
else gotoxy(25,y);
|
||||
o=bioskey(0);
|
||||
if(o==14624)
|
||||
{
|
||||
cprintf("AV");
|
||||
strcpy(reg2.estado_asig[y-7],"AV");
|
||||
}
|
||||
if(o==7181)
|
||||
{
|
||||
cprintf("AO");
|
||||
strcpy(reg2.estado_asig[y-7],"AO");
|
||||
}
|
||||
strcpy(reg2.nombre_asig[y-7],BCN1[y-7]);
|
||||
}
|
||||
fwrite(®2,sizeof(ALUMNO_B1),1,bcn1a);
|
||||
break;
|
||||
case 2:
|
||||
for(y=7;y<22;y++)
|
||||
{
|
||||
if(y<13) gotoxy(22,y);
|
||||
else gotoxy(25,y);
|
||||
o=bioskey(0);
|
||||
if(o==14624)
|
||||
{
|
||||
cprintf("AV");
|
||||
strcpy(reg2.estado_asig[y-7],"AV");
|
||||
}
|
||||
if(o==7181)
|
||||
{
|
||||
cprintf("AO");
|
||||
strcpy(reg2.estado_asig[y-7],"AO");
|
||||
}
|
||||
strcpy(reg2.nombre_asig[y-7],BCN1[y-7]);
|
||||
}
|
||||
fwrite(®2,sizeof(ALUMNO_B1),1,bcn1b);
|
||||
break;
|
||||
case 3:
|
||||
for(y=5;y<23;y++)
|
||||
{
|
||||
if(y<7) gotoxy(22,y);
|
||||
else gotoxy(25,y);
|
||||
gotoxy(22,y);
|
||||
if(o==14624)
|
||||
{
|
||||
cprintf("AV");
|
||||
strcpy(reg3.estado_asig[y-5],"AV");
|
||||
}
|
||||
if(o==7181)
|
||||
{
|
||||
cprintf("AO");
|
||||
strcpy(reg3.estado_asig[y-5],"AO");
|
||||
}
|
||||
strcpy(reg3.nombre_asig[y-5],BCN2[y-5]);
|
||||
}
|
||||
fwrite(®3,sizeof(ALUMNO_B2),1,bcn2a);
|
||||
break;
|
||||
case 4:
|
||||
for(y=5;y<23;y++)
|
||||
{
|
||||
if(y<7) gotoxy(22,y);
|
||||
else gotoxy(25,y);
|
||||
o=bioskey(0);
|
||||
if(o==14624)
|
||||
{
|
||||
cprintf("AV");
|
||||
strcpy(reg3.estado_asig[y-5],"AV");
|
||||
}
|
||||
if(o==7181)
|
||||
{
|
||||
cprintf("AO");
|
||||
strcpy(reg3.estado_asig[y-5],"AO");
|
||||
}
|
||||
strcpy(reg3.nombre_asig[y-5],BCN2[y-5]);
|
||||
}
|
||||
fwrite(®3,sizeof(ALUMNO_B2),1,bcn2b);
|
||||
}
|
||||
break;
|
||||
case 3://ALUMNOS DE CFGS
|
||||
switch(subopcion1)
|
||||
{
|
||||
case 1:
|
||||
for(y=12;y<16;y++)
|
||||
{
|
||||
gotoxy(22,y);
|
||||
o=bioskey(0);
|
||||
if(o==14624)
|
||||
{
|
||||
cprintf("AV");
|
||||
strcpy(reg4.estado_asig[y-12],"AV");
|
||||
}
|
||||
if(o==7181)
|
||||
{
|
||||
cprintf("AO");
|
||||
strcpy(reg4.estado_asig[y-12],"AO");
|
||||
}
|
||||
strcpy(reg4.nombre_asig[y-12],CFGS1[y-12]);
|
||||
}
|
||||
fwrite(®4,sizeof(ALUMNO_C1),1,cfgs1a);
|
||||
break;
|
||||
case 2:
|
||||
for(y=12;y<16;y++)
|
||||
{
|
||||
gotoxy(22,y);
|
||||
o=bioskey(0);
|
||||
if(o==14624)
|
||||
{
|
||||
cprintf("AV");
|
||||
strcpy(reg4.estado_asig[y-12],"AV");
|
||||
}
|
||||
if(o==7181)
|
||||
{
|
||||
cprintf("AO");
|
||||
strcpy(reg4.estado_asig[y-12],"AO");
|
||||
}
|
||||
strcpy(reg4.nombre_asig[y-12],CFGS1[y-12]);
|
||||
}
|
||||
fwrite(®4,sizeof(ALUMNO_C1),1,cfgs1b);
|
||||
break;
|
||||
case 3:
|
||||
for(y=11;y<16;y++)
|
||||
{
|
||||
gotoxy(22,y);
|
||||
o=bioskey(0);
|
||||
if(o==14624)
|
||||
{
|
||||
cprintf("AV");
|
||||
strcpy(reg5.estado_asig[y-11],"AV");
|
||||
}
|
||||
if(o==7181)
|
||||
{
|
||||
cprintf("AO");
|
||||
strcpy(reg5.estado_asig[y-11],"AO");
|
||||
}
|
||||
strcpy(reg5.nombre_asig[y-11],CFGS2[y-11]);
|
||||
}
|
||||
fwrite(®5,sizeof(ALUMNO_C2),1,cfgs2);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
switch(subopcion) //visualiza datos
|
||||
{
|
||||
case 1://ALUMNOS DE ESO
|
||||
switch(subopcion1)
|
||||
{
|
||||
case 1:
|
||||
while(!feof(eso3a))
|
||||
{
|
||||
fread(&busca,sizeof(ALUMNO_E3),1,eso3a);
|
||||
if(strcmp(nombre,busca.nombre_alumno)==0)
|
||||
for(i=0;i<16;i++)
|
||||
{
|
||||
gotoxy(22,i+5);
|
||||
cprintf("%s:%s",busca.nombre_asig[i],busca.estado_asig[i]);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
while(!feof(eso3b))
|
||||
{
|
||||
fread(&busca,sizeof(ALUMNO_E3),1,eso3b);
|
||||
if(strcmp(nombre,busca.nombre_alumno)==0)
|
||||
for(i=0;i<16;i++)
|
||||
{
|
||||
gotoxy(22,i+5);
|
||||
cprintf("%s:%s",busca.nombre_asig[i],busca.estado_asig[i]);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
while(!feof(eso4a))
|
||||
{
|
||||
fread(&busca1,sizeof(ALUMNO_E4),1,eso4a);
|
||||
if(strcmp(nombre,busca1.nombre_alumno)==0)
|
||||
for(i=0;i<20;i++)
|
||||
{
|
||||
gotoxy(22,i+4);
|
||||
cprintf("%s:%s",busca1.nombre_asig[i],busca1.estado_asig[i]);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
while(!feof(eso4b))
|
||||
{
|
||||
fread(&busca1,sizeof(ALUMNO_E4),1,eso4b);
|
||||
if(strcmp(nombre,busca1.nombre_alumno)==0)
|
||||
for(i=0;i<20;i++)
|
||||
{
|
||||
gotoxy(22,i+4);
|
||||
cprintf("%s:%s",busca1.nombre_asig[i],busca1.estado_asig[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2://ALUMNOS DE BCN
|
||||
switch(subopcion1)
|
||||
{
|
||||
case 1:
|
||||
while(!feof(bcn1a))
|
||||
{
|
||||
fread(&busca2,sizeof(ALUMNO_B1),1,bcn1a);
|
||||
if(strcmp(nombre,busca2.nombre_alumno)==0)
|
||||
for(i=0;i<15;i++)
|
||||
{
|
||||
gotoxy(22,i+6);
|
||||
cprintf("%s:%s",busca2.nombre_asig[i],busca2.estado_asig[i]);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
while(!feof(bcn1b))
|
||||
{
|
||||
fread(&busca2,sizeof(ALUMNO_B1),1,bcn1b);
|
||||
if(strcmp(nombre,busca2.nombre_alumno)==0)
|
||||
for(i=0;i<15;i++)
|
||||
{
|
||||
gotoxy(22,i+6);
|
||||
cprintf("%s:%s",busca2.nombre_asig[i],busca2.estado_asig[i]);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
while(!feof(bcn2a))
|
||||
{
|
||||
fread(&busca3,sizeof(ALUMNO_B2),1,bcn2a);
|
||||
if(strcmp(nombre,busca3.nombre_alumno)==0)
|
||||
for(i=0;i<18;i++)
|
||||
{
|
||||
gotoxy(22,i+5);
|
||||
cprintf("%s:%s",busca3.nombre_asig[i],busca3.estado_asig[i]);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
while(!feof(bcn2b))
|
||||
{
|
||||
fread(&busca3,sizeof(ALUMNO_B2),1,bcn2b);
|
||||
if(strcmp(nombre,busca3.nombre_alumno)==0)
|
||||
for(i=0;i<18;i++)
|
||||
{
|
||||
gotoxy(22,i+5);
|
||||
cprintf("%s:%s",busca3.nombre_asig[i],busca3.estado_asig[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 3://ALUMNOS DE CFGS
|
||||
switch(subopcion1)
|
||||
{
|
||||
case 1:
|
||||
while(!feof(cfgs1a))
|
||||
{
|
||||
fread(&busca4,sizeof(ALUMNO_C1),1,cfgs1a);
|
||||
if(strcmp(nombre,busca4.nombre_alumno)==0)
|
||||
for(i=0;i<4;i++)
|
||||
{
|
||||
gotoxy(22,i+11);
|
||||
cprintf("%s:%s",busca4.nombre_asig[i],busca4.estado_asig[i]);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
while(!feof(cfgs1b))
|
||||
{
|
||||
fread(&busca4,sizeof(ALUMNO_C1),1,cfgs1b);
|
||||
if(strcmp(nombre,busca4.nombre_alumno)==0)
|
||||
for(i=0;i<4;i++)
|
||||
{
|
||||
gotoxy(22,i+11);
|
||||
cprintf("%s:%s",busca4.nombre_asig[i],busca4.estado_asig[i]);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
while(!feof(cfgs2))
|
||||
{
|
||||
fread(&busca5,sizeof(ALUMNO_C2),1,cfgs2);
|
||||
if(strcmp(nombre,busca5.nombre_alumno)==0)
|
||||
for(i=0;i<5;i++)
|
||||
{
|
||||
gotoxy(22,i+11);
|
||||
cprintf("%s:%s",busca5.nombre_asig[i],busca5.estado_asig[i]);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
getch();
|
||||
textattr(119);
|
||||
gotoxy(2,25);
|
||||
cprintf("RETURN[Asignatura Obligatoria],ESPACIO[Asignatura Convalidada]");
|
||||
textattr(7);
|
||||
recuadro(16,3,41,24,1);
|
||||
fclose(eso3a);
|
||||
fclose(eso3b);
|
||||
fclose(eso4a);
|
||||
fclose(eso4b);
|
||||
fclose(bcn1a);
|
||||
fclose(bcn1b);
|
||||
fclose(bcn2a);
|
||||
fclose(bcn2b);
|
||||
fclose(cfgs1a);
|
||||
fclose(cfgs1b);
|
||||
fclose(cfgs2);
|
||||
}
|
||||
//CAPTURA
|
||||
void captura(int tam, char intochar, OPCION cap,char nombre[20])
|
||||
{
|
||||
int i=0,c=0;
|
||||
if (intochar=='i')
|
||||
{
|
||||
do
|
||||
{
|
||||
cap.matriz1[i]=getch();
|
||||
if (isdigit(cap.matriz1[i])==0)
|
||||
{
|
||||
i--;
|
||||
if (i==-1)
|
||||
i++;
|
||||
}
|
||||
else
|
||||
{
|
||||
cprintf("%c",cap.matriz1[i]);
|
||||
i++;
|
||||
c++;
|
||||
}
|
||||
}
|
||||
while((cap.matriz1[i]!='\r') && (c+1<tam));
|
||||
// strcpy(cap.matriz1[i+1],'\0');
|
||||
cap.matriz1[i+1]='\0';
|
||||
}
|
||||
if (intochar=='c')
|
||||
{
|
||||
do
|
||||
{
|
||||
cap.matriz2[i]=getch();
|
||||
if (isalpha(cap.matriz2[i])==0&&cap.matriz2[i]!=' '&&cap.matriz2[i]!='¤'&&cap.matriz2[i]!='¥')
|
||||
{
|
||||
i--;
|
||||
if (i==-1)
|
||||
i++;
|
||||
}
|
||||
else
|
||||
{
|
||||
cprintf("%c",cap.matriz2[i]);
|
||||
i++;
|
||||
c++;
|
||||
}
|
||||
}while((cap.matriz2[i+1]!='\r') && (c+1<tam));
|
||||
//strcpy(cap.matriz2[i+1],'\0');
|
||||
while(cap.matriz2[i+1]!='\r')
|
||||
{
|
||||
cap.matriz2[i+1]=getch();
|
||||
}
|
||||
cap.matriz2[i+1]='\0';
|
||||
}
|
||||
if (intochar=='i')
|
||||
strcpy(nombre,cap.matriz1);
|
||||
else strcpy(nombre,cap.matriz2);
|
||||
|
||||
}
|
||||
|
0
CFGS1A.DAT
Normal file
0
CFGS1A.DAT
Normal file
0
CFGS1B.DAT
Normal file
0
CFGS1B.DAT
Normal file
357
COLE1.CPP
Normal file
357
COLE1.CPP
Normal file
@ -0,0 +1,357 @@
|
||||
|
||||
//bibliotecas empleadas
|
||||
#include<stdlib.h>
|
||||
#include<stdio.h>
|
||||
#include<conio.h>
|
||||
#include<dos.h>
|
||||
//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;i<c[1]+1;i++)
|
||||
{
|
||||
if(cliente[i][0]==1) suma[0]=suma[0]+cliente[i][2];
|
||||
if(cliente[i][0]==2) suma[1]=suma[1]+cliente[i][2];
|
||||
if(cliente[i][0]==3) suma[2]=suma[2]+cliente[i][2];
|
||||
if(cliente[i][0]==4) suma[3]=suma[3]+cliente[i][2];
|
||||
|
||||
}
|
||||
for(i=1;i<5;i++)
|
||||
{
|
||||
gotoxy(30,12+i);
|
||||
cprintf("Localidades de sala %i¦:%i",i,suma[i-1]);
|
||||
}
|
||||
getch();
|
||||
break;
|
||||
case '2':
|
||||
clrscr();
|
||||
for(i=0;i<c[1];i++)
|
||||
{
|
||||
suma[0]=suma[0]+importe[i];
|
||||
}
|
||||
gotoxy(35,10);
|
||||
cprintf("Importe total:%i",suma[0]);
|
||||
getch();
|
||||
break;
|
||||
case '3':
|
||||
clrscr();
|
||||
for(i=0;i<c[1]+1;i++)
|
||||
{
|
||||
if(cliente[i][1]==1) suma[0]=suma[0]+cliente[i][2];
|
||||
if(cliente[i][1]==2) suma[1]=suma[1]+cliente[i][2];
|
||||
if(cliente[i][1]==3) suma[2]=suma[2]+cliente[i][2];
|
||||
}
|
||||
for(i=1;i<4;i++)
|
||||
{
|
||||
gotoxy(30,12+i);
|
||||
cprintf("Localidades de sesion %i¦:%i",i,suma[i-1]);
|
||||
}
|
||||
getch();
|
||||
break;
|
||||
default :
|
||||
if(o!=' ') error();
|
||||
}
|
||||
if(o==' ') return ' ';
|
||||
else return '3';
|
||||
|
||||
}
|
||||
//error
|
||||
void error()
|
||||
{
|
||||
textcolor(10);
|
||||
gotoxy(32,2);
|
||||
cprintf("Eleccion incorrecta");
|
||||
getch();
|
||||
printf(" ");
|
||||
|
||||
}
|
||||
//pantalla de presentacion
|
||||
void inicio()
|
||||
{
|
||||
char texto[12]={"BIENVENIDO"};
|
||||
int x,y,z;
|
||||
randomize();
|
||||
|
||||
z=(rand() %14)+1;
|
||||
textcolor(z);
|
||||
for(x=1;x<70;x++)
|
||||
{
|
||||
gotoxy(x,12);
|
||||
cprintf(" %s",texto);
|
||||
delay(25);
|
||||
}
|
||||
for(x=70;x>34;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);
|
||||
}
|
||||
}
|
||||
}
|
304
DAVID.CPP
Normal file
304
DAVID.CPP
Normal file
@ -0,0 +1,304 @@
|
||||
#include<stdio.h>
|
||||
#include<math.h>
|
||||
#include<graphics.h>
|
||||
#include<conio.h>
|
||||
#include<dos.h>
|
||||
#include<ctype.h>
|
||||
|
||||
#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++;}
|
||||
|
||||
}
|
||||
}
|
||||
|
BIN
DEMO/DAC.PCX
Normal file
BIN
DEMO/DAC.PCX
Normal file
Binary file not shown.
897
DEMO/DEMO.CPP
Normal file
897
DEMO/DEMO.CPP
Normal file
@ -0,0 +1,897 @@
|
||||
//Bibliotecas
|
||||
#include <mem.h>
|
||||
#include <mem.h>
|
||||
#include<stdio.h>
|
||||
#include<conio.h>
|
||||
#include<math.h>
|
||||
#include<graphics.h>
|
||||
#include<dos.h>
|
||||
#include<ctype.h>
|
||||
#include<string.h>
|
||||
#include<stdlib.h>
|
||||
//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;a<l;a++)
|
||||
{
|
||||
if(toascii(texto1[a]-65)<14)
|
||||
n[a]=toascii(texto1[a]-64);
|
||||
else if(texto1[a]=='¥')
|
||||
n[a]=15;
|
||||
else if(texto1[a]==' ')
|
||||
n[a]=0;
|
||||
else
|
||||
n[a]=toascii(texto1[a]-63);
|
||||
}
|
||||
a=0;
|
||||
while(kbhit())getch();
|
||||
while(y>170&&!kbhit())
|
||||
{
|
||||
while(a<l)
|
||||
{
|
||||
x=x+7;
|
||||
if(letras[n[a]][c]==0||y<190) setcolor(0);
|
||||
else { randomize();color=rand() %14+1;setcolor(color);}
|
||||
for(i=1;i<10;i++)
|
||||
{
|
||||
line(x+i,1,x+i,y);
|
||||
delay(1);
|
||||
}
|
||||
c++;
|
||||
if(c==56-c1) {a++;c=48-c1;}
|
||||
}
|
||||
c1=c1+8;
|
||||
c=c-8;
|
||||
a=0;
|
||||
x=0;
|
||||
y=y-10;
|
||||
}
|
||||
sleep(1);
|
||||
//Borrado
|
||||
for(a=170;a<260;a++)
|
||||
{
|
||||
for(x=1;x<640;x++)
|
||||
{
|
||||
putpixel(x,a,0);
|
||||
}
|
||||
delay(5);
|
||||
}
|
||||
clearviewport();
|
||||
}
|
||||
|
||||
//DEMO2
|
||||
void demo2()
|
||||
{
|
||||
int b=10,p=0,i,j,cont=0,a=0,x;
|
||||
char c;
|
||||
while(cont<25&&!kbhit())
|
||||
{
|
||||
clearviewport();
|
||||
x=(rand() %14)+1;
|
||||
setcolor(x);
|
||||
for(i=0;i<360;i++)
|
||||
{
|
||||
line(320+p*cos(b*i),230+p*sin(b*i),320+p*cos(b*(i+1)),230+p*sin(b*(i+1)));
|
||||
a++;
|
||||
if (a==4)
|
||||
{
|
||||
a=0;
|
||||
p=p+4;
|
||||
}
|
||||
delay(1);
|
||||
}
|
||||
//nuevos valores para variables
|
||||
delay(500);
|
||||
b=b+1;
|
||||
p=0;
|
||||
cont++;
|
||||
}
|
||||
setcolor(0);
|
||||
for(i=0;i<480;i=i+2)
|
||||
{
|
||||
line(0,i,640,i);
|
||||
line(0,479-i,640,479-i);
|
||||
delay(20);
|
||||
}
|
||||
}
|
||||
//DEMO3
|
||||
void demo3()
|
||||
{
|
||||
int x,y,cont=0,x1,y1;
|
||||
while(cont<4&&!kbhit())
|
||||
{
|
||||
for(x=1;x<320;x++)
|
||||
{
|
||||
for(y=1;y<360;y++)
|
||||
{
|
||||
if(cont==0) {x1=y+160+x*cos(y);y1=x+10+x*sin(y);}
|
||||
if(cont==1) {x1=y+160+x*cos(y);y1=x+10+x*tan(y);}
|
||||
if(cont==2) {x1=y+160+x*cos(y);y1=x+10+x*cos(y);}
|
||||
if(cont==3) {x1=y+160+x*tan(y);y1=x+10+x*sin(y);}
|
||||
putpixel(x1,y1,cont+1);
|
||||
}
|
||||
delay(10);
|
||||
}
|
||||
sleep(1);
|
||||
cont++;
|
||||
clearviewport();
|
||||
}
|
||||
}
|
||||
//DEMO4
|
||||
void demo4()
|
||||
{
|
||||
|
||||
// Inicializamos el modo SVGA 640*480 256 c. ( VESA )
|
||||
closegraph();
|
||||
InicializaSVGA();
|
||||
MuestraImagen( "dac.pcx" );
|
||||
sleep(5);
|
||||
clearviewport();
|
||||
//closegraph();
|
||||
|
||||
}
|
||||
int MuestraImagen( char *file )
|
||||
{
|
||||
int alto, ancho, contador;
|
||||
unsigned char byte;
|
||||
FILE *fp;
|
||||
|
||||
CargaPaleta( file );
|
||||
|
||||
|
||||
if ( (fp = fopen( file,"rb")) != NULL )
|
||||
{
|
||||
// Saltamos la cabecera
|
||||
fseek( fp, 128, SEEK_SET );
|
||||
|
||||
for(alto=0; alto<RES_Y; alto++)
|
||||
{
|
||||
for(ancho=0; ancho<RES_X; )
|
||||
{
|
||||
byte=getc(fp);
|
||||
if(byte<=0xC0)
|
||||
{
|
||||
putpixel (ancho, alto, byte);
|
||||
ancho++;
|
||||
} else {
|
||||
contador=byte&0x3F; byte=getc(fp);
|
||||
for(; contador>0; 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<SALTOS_ANCHOS*PROFUNDIDAD_TUNEL; depth+=SALTOS_ANCHOS*INCREMENTAL, Movimiento+=SALTOS_PROFUNDOS, Color++ )
|
||||
// for ( depth=INCREMENTAL*SALTOS_ANCHOS*(PROFUNDIDAD_TUNEL-1); 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<l;a++)
|
||||
{
|
||||
if(toascii(texto[a]-65)<14)
|
||||
n[a]=toascii(texto[a]-64);
|
||||
else if(texto[a]=='¥')
|
||||
n[a]=15;
|
||||
else if(texto[a]==' ')
|
||||
n[a]=0;
|
||||
else
|
||||
n[a]=toascii(texto[a]-63);
|
||||
}
|
||||
while(c3!=l&&!kbhit())
|
||||
{
|
||||
while(y<70)
|
||||
{
|
||||
if(c3<l)
|
||||
{
|
||||
if(letras[n[c3]][i]==1) setcolor(color);
|
||||
else setcolor(0);
|
||||
}
|
||||
//V =20*sin(x*k);
|
||||
outtextxy(x,200+y,"*");
|
||||
if(x>=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<r)
|
||||
{
|
||||
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;}
|
||||
if(x==abs(c1)) break;
|
||||
}
|
||||
c4++;
|
||||
}
|
||||
if(c4==8) {c4=0;ac3++;ac1=0;}
|
||||
y=0;x=0;
|
||||
i1=i;
|
||||
}
|
||||
}
|
BIN
DEMO/DEMO.EXE
Normal file
BIN
DEMO/DEMO.EXE
Normal file
Binary file not shown.
BIN
DEMO/SVGA256.BGI
Normal file
BIN
DEMO/SVGA256.BGI
Normal file
Binary file not shown.
57
DIBUJO.CPP
Normal file
57
DIBUJO.CPP
Normal file
@ -0,0 +1,57 @@
|
||||
#include<stdio.h>
|
||||
#include<conio.h>
|
||||
#include<stdlib.h>
|
||||
#include<graphics.h>
|
||||
#include<math.h>
|
||||
#include<dos.h>
|
||||
|
||||
|
||||
//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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
BIN
DIBUJO.EXE
Normal file
BIN
DIBUJO.EXE
Normal file
Binary file not shown.
BIN
EGAVGA.BGI
Normal file
BIN
EGAVGA.BGI
Normal file
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user