Backup proyecto Joyfe - Borland

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

161
CPP/ACTU.CPP Normal file
View File

@ -0,0 +1,161 @@
#include <conio.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
FILE *maes, *mov, *maestmp, *historico;
struct clientes{
char nombre[11], apellidos[21], direccion[21], telefono[11];
int codigo;
};
struct maestro {
int codigo;
char nombre[11], apellidos[21];
char direccion[21], telefono[11];
}regmaes;
struct movi {
char tipo;
int codigo;
char nombre[10], apellidos[20];
char direccion[20], telefono[10];
}regmov;
void limpiar1(), limpiar2();
void main(void){
struct clientes cli;
mov=fopen("k:\\files\\clientes.mov","r+b");
if ((maes=fopen("k:\\files\\clientes.dat","r+b"))==NULL){
//fclose(maes);
maes=fopen("k:\\files\\clientes.dat","w+b");
while (!feof(mov)){
limpiar1();limpiar2();
fread(&regmov,sizeof(regmov),1,mov);
if (regmov.tipo=='A') {
strcpy (regmaes.apellidos,regmov.apellidos);
strcpy (regmaes.nombre,regmov.nombre);
regmaes.codigo=regmov.codigo;
strcpy (regmaes.direccion,regmov.direccion);
strcpy (regmaes.telefono,regmov.telefono);
clrscr();
printf ("%d \n%s \n%s \n%s \n%s", regmaes.codigo, regmaes.nombre,regmaes.apellidos, regmaes.direccion, regmaes.telefono);
getch();
fwrite (&regmaes,sizeof(struct maestro),1,maes);
}
}
}
else{
fclose(maes);
system("rename k:\\files\\clientes.dat clientes.tmp");
maes=fopen("k:\\files\\clientes.dat","w+b");
maestmp=fopen("k:\\files\\clientes.tmp","rb");
historico=fopen("k:\\files\\clientes.log","a+b");
limpiar1();limpiar2();
fread(&regmov,sizeof(regmov),1,mov);
fread(&regmaes,sizeof(regmaes),1,maestmp);
while (!feof(mov) && !feof(maestmp)){
if (regmaes.codigo==regmov.codigo){
if(regmov.tipo=='A'){
printf("Error cliente duplicado.");getch();
fwrite(&regmaes,sizeof(regmaes),1,maes);
limpiar1();limpiar2();
fread(&regmov,sizeof(regmov),1,mov);
fread(&regmaes,sizeof(regmaes),1,maestmp);
}
else{
if (regmov.tipo=='B'){
printf("Dando de baja...");
fwrite(&regmaes,sizeof(regmaes),1,historico);
limpiar1();limpiar2();
fread(&regmov,sizeof(regmov),1,mov);
fread(&regmaes,sizeof(regmaes),1,maestmp);
}
else{
fwrite(&(regmov.codigo),2,1,maes);
fwrite(&(regmov.nombre),11,1,maes);
fwrite(&(regmov.apellidos),21,1,maes);
fwrite(&(regmov.direccion),21,1,maes);
fwrite(&(regmov.telefono),11,1,maes);
limpiar1();limpiar2();
fread(&regmov,sizeof(regmov),1,mov);
fread(&regmaes,sizeof(regmaes),1,maestmp);
}
}
}
else{
if(regmov.codigo>regmaes.codigo){
fwrite(&regmaes,sizeof(regmaes),1,maes);
limpiar2();
fread(&regmaes,sizeof(regmaes),1,maestmp);
}
else{
if (regmov.tipo=='A'){
fwrite(&(regmov.codigo),2,1,maes);
fwrite(&(regmov.nombre),10,1,maes);
fwrite(&(regmov.apellidos),20,1,maes);
fwrite(&(regmov.direccion),20,1,maes);
fwrite(&(regmov.telefono),10,1,maes);
}
else{
printf("Error: El cliente no existe.");getch();
}
limpiar1();
fread(&regmov,sizeof(regmov),1,mov);
}
}
} // fin del while
if (!feof(mov)){
while(!feof(mov)){
if(regmov.tipo=='A'){
strcpy (regmaes.apellidos,regmov.apellidos);
strcpy (regmaes.nombre,regmov.nombre);
regmaes.codigo=regmov.codigo;
strcpy (regmaes.direccion,regmov.direccion);
strcpy (regmaes.telefono,regmov.telefono);
clrscr();
printf ("%d \n%s \n%s \n%s \n%s", regmaes.codigo, regmaes.nombre,regmaes.apellidos, regmaes.direccion, regmaes.telefono);
getch();
fwrite (&regmaes,sizeof(struct maestro),1,maes);
}
else{
printf("Error: El cliente no existe.");getch();
}
limpiar1();
fread(&regmov,sizeof(regmov),1,mov);
}
}
else{
if(!feof(maestmp)){
while(!feof(maestmp)){
fwrite(&regmaes,sizeof(regmaes),1,maes);
limpiar2();
fread(&regmaes,sizeof(regmaes),1,maestmp);
}
}
}
fcloseall();
}
unlink("k:\\files\\clientes.mov");
unlink("k:\\files\\clientes.tmp");
}
void limpiar1(){
regmov.tipo=NULL;regmov.codigo=0;
for (int n=0;n<21;n++){
regmov.apellidos[n]=NULL;regmov.direccion[n]=NULL;
}
for(n=0;n<11;n++){
regmov.nombre[n]=NULL;regmov.telefono[n]=NULL;
}
}
void limpiar2(){
for (int n=0;n<21;n++){
regmaes.apellidos[n]=NULL;regmaes.direccion[n]=NULL;
}
for (n=0;n<11;n++){
regmaes.nombre[n]=NULL;regmaes.telefono[n]=NULL;
}
regmaes.codigo=0;
}

238
CPP/ARBOL.CPP Normal file
View File

@ -0,0 +1,238 @@
#include <stdio.h>
#include <conio.h>
#include <alloc.h>
#include <iostream.h>
#include <alloc.h>
#include <stdlib.h>
struct nodo {
int dato;
struct nodo *padre;
struct nodo *hi;
struct nodo *hd;
};
int ARBOL_VACIO (struct nodo *);
void INI_ARBOL (struct nodo **);
void INS_ARBOL (struct nodo **, int);
int PROFUNDIDAD (struct nodo *);
void ELIMINAR_NODO (struct nodo **, struct nodo *);
void LISTAR_IRD(struct nodo *);
struct nodo* BUSCAR_NODO(struct nodo*,int);
void main (void) {
int d;
struct nodo *arbol;
INI_ARBOL(&arbol);
clrscr();
while (d!=0){
printf ("\nNumero: ");
cin >> d;
if (d!=0)
INS_ARBOL(&arbol, d);
}
printf("Presione ENTER para continuar, ESC finaliza.\n");
printf ("\nListado del <20>rbol:");
printf ("\n------------------\n");
LISTAR_IRD(arbol);
printf ("\n------------------\n");
cout << "\nLa profundidad del <20>rbol es " << PROFUNDIDAD(arbol);
printf("\nLado Izquierdo-> %d", PROFUNDIDAD(arbol->hi));
printf("\tLado Derecho-> %d", PROFUNDIDAD(arbol->hd));
printf("\n Raiz: %d",arbol->dato);getch();
getch();
int victima;
while (!ARBOL_VACIO(arbol)) {
printf("\nIntroduce un nodo a eliminar: ");
cin >> victima;
ELIMINAR_NODO(&arbol,BUSCAR_NODO(arbol,victima));
printf ("\nListado del <20>rbol:");
printf ("\n------------------\n");
LISTAR_IRD(arbol);
printf ("\n------------------\n");
cout << "\nLa profundidad del <20>rbol es " << PROFUNDIDAD(arbol);
printf("\nLado Izquierdo-> %d", PROFUNDIDAD(arbol->hi));
printf("\tLado Derecho-> %d", PROFUNDIDAD(arbol->hd));
if (arbol!=NULL)
printf("\n Raiz: %d",(arbol->dato));getch();
getch();
}
free (arbol);
}
int ARBOL_VACIO(struct nodo *p) {
return (p == NULL);
}
void INI_ARBOL(struct nodo **p) { *p = NULL; }
void INS_ARBOL(struct nodo **p, int n) {
struct nodo *aux;
struct nodo **q;
int sw;
if ((aux = (struct nodo*) malloc (sizeof (struct nodo)))== NULL)
exit(1);
aux->dato = n;
if (ARBOL_VACIO(*p)) {
aux->hi = NULL;
aux->hd = NULL;
aux->padre = aux;
*p = aux;
}
else {
sw = 1;
q = p;
while (sw) {
sw = 0;
if ((*q)->dato <= n && (*q)->hd != NULL) {
q = &(*q)->hd;
sw = 1;
}
if ((*q)->dato >= n && (*q)->hi != NULL) {
q = &(*q)->hi;
sw = 1;
}
}
aux->hi = aux->hd = NULL;
aux->padre = (*q);
((*q)->dato < n) ? (*q)->hd = aux : (*q)->hi = aux;
}
}
int PROFUNDIDAD(struct nodo *p) {
int nivelhi=0;
int nivelhd=0;
if (p != NULL) {
nivelhi++;
nivelhi+=PROFUNDIDAD(p -> hi);
nivelhd++;
nivelhd+=PROFUNDIDAD(p -> hd);
}
return (nivelhd > nivelhi) ? nivelhd : nivelhi;
}
void ELIMINAR_NODO (struct nodo **p, struct nodo *q) {
if (q==NULL)
printf("Error. Se ha intentado eliminar un nodo NO EXISTENTE.");
else {
if (q->hd == NULL && q->hi == NULL && q->padre != q) { // ES HOJA
if ((q->padre)->hd == q)
(q->padre)->hd = NULL; // ES UN HD
else
(q->padre)->hi = NULL; // ES UN HI
} // fin del if si es hoja
else {
if ((q->padre) == q && q->hd == NULL && q->hi == NULL)// RAIZ SIN HIJOS
*p = NULL;
else {
if (q->hd != NULL && q->hi == NULL) {// NO TIENE HI
if (q->padre==q)
*p=q->hd;
else
if ((q->padre)->hd == q) // ES UN HD
(q->padre)->hd = q->hd;
else
(q->padre)->hi = q->hd; // ES UN HI
} // fin del if no tiene HI
else {
if (q->hd == NULL && q->hi != NULL) {// NO TIENE HD
if (q->padre==q)
*p=q->hi;
else
if ((q->padre)->hd == q)
(q->padre)->hd = q->hi;
else
(q->padre)->hi = q->hi;
} // fin del if no tiene hd
else {
if (q->hd != NULL && q->hi != NULL){ //TIENE 2 HIJOS
struct nodo *aux = NULL;
if (PROFUNDIDAD(q->hi) > (PROFUNDIDAD (q->hd))) {
aux=q->hi;
while (aux->hd != NULL) {aux = aux->hd;}
}
else {
aux=q->hd;
while (aux->hi != NULL) {aux = aux->hi;}
}
struct nodo *nodotmp = NULL;
if ((nodotmp = (struct nodo*) malloc (sizeof (struct nodo)))==NULL){
printf ("\nError Memory Allocation !!");
printf ("\nNo hay memoria suficiente, abortando ...");
exit(1);
}
nodotmp->dato = aux->dato;
if (q->hd == aux)
nodotmp->hd = aux->hd;
else
nodotmp->hd = q->hd;
if (q->hi == aux)
nodotmp->hi = aux->hi;
else
nodotmp->hi = q->hi;
if ((q->padre)==q){ // ES RAIZ
*p = nodotmp;
nodotmp->padre=nodotmp;
}
else
if ((q->padre)->hd == q) {// ES UN HD
(q->padre)->hd = nodotmp;
nodotmp->padre=q->padre;
}
else {
(q->padre)->hi = nodotmp; // ES UN HI
nodotmp->padre=q->padre;
}
ELIMINAR_NODO(p, aux);
} // fin del if
} // fin del else
} // fin del else
} // fin del else
} // fin del else
} // fin del else
free (q);
} // fin de la funcion eliminar_nodo
void LISTAR_IRD(struct nodo *p){
if (p!=NULL){
LISTAR_IRD(p->hi);
printf("%d ",p->dato);
LISTAR_IRD(p->hd);
}
}
struct nodo* BUSCAR_NODO(struct nodo *p,int n){
if (p==NULL || n==p->dato)
return p;
else
if (n<p->dato)
return (BUSCAR_NODO(p->hi,n));
else
return (BUSCAR_NODO(p->hd,n));
}

BIN
CPP/ARBOL.EXE Normal file

Binary file not shown.

BIN
CPP/ARBOL.OBJ Normal file

Binary file not shown.

313
CPP/ARBOLBI.CPP Normal file
View File

@ -0,0 +1,313 @@
#include <conio.h>
#include <stdio.h>
#include <stdlib.h>
#include <iostream.h>
#include <dos.h>
struct nodo{
int dato;
struct nodo *hi;
struct nodo *hd;
struct nodo *padre;
};
void insertar (struct nodo **,int);
int esvacio(struct nodo *);
void listar_ird(struct nodo *);
struct nodo* buscar_nodo(struct nodo*,int);
void eliminar_nodo(struct nodo**,struct nodo*);
void eliminar(struct nodo*,struct nodo*);
void main(void){
struct nodo *arbol=NULL,*aux=NULL;int n=0;char tecla=NULL;
do{
clrscr();
printf ("Inserta nuevo nodo:");
cin >> n;
aux=buscar_nodo(arbol,n);
if (aux==NULL){
insertar(&arbol,n);
printf ("\nPara finalizar de introducir nodos pulse ESC.");
tecla=getch();
}
else{
nosound();sound(500);delay(500);nosound();
}
}while (tecla!=27);
clrscr();
listar_ird(arbol);getch();
while (n!=0){
printf ("\nRaiz %d",arbol->dato);
printf("\nIndica el nodo a eliminar: \n");
cin >> n;
aux=buscar_nodo(arbol,n);
eliminar(arbol,aux);
listar_ird(arbol);getch();
}
}
int esvacio(struct nodo *p){
return(p==NULL);
}
void insertar (struct nodo **p,int n){
struct nodo *aux=NULL;
if ((aux=(struct nodo *)malloc(sizeof(struct nodo)))==NULL){
clrscr();
printf ("No hay memoria suficiente.");
getch();
exit(1);
}
else{
if (esvacio(*p)){
aux->dato=n;aux->hd=NULL;aux->hi=NULL;aux->padre=aux;
(*p)=aux;
}
else{
struct nodo **q=NULL;
q=p;int sw=1;
while (sw==1){
sw=0;
if ((*q)->dato<n && (*q)->hd!=NULL){
q=&((*q)->hd);sw=1;
}
if ((*q)->dato>n && (*q)->hi!=NULL){
q=&((*q)->hi);sw=1;
}
}
aux->dato=n;aux->hi=NULL;aux->hd=NULL;aux->padre=(*q);
if ((*q)->dato<n)
(*q)->hd=aux;
else
(*q)->hi=aux;
}
}
}
void listar_ird(struct nodo *p) { //int x,int y){
if (p!=NULL){
//gotoxy(x,y);
printf("%d ",p->dato);
listar_ird(p->hi);
listar_ird(p->hd);
}
}
struct nodo* buscar_nodo(struct nodo *p,int n){
if (p==NULL || n==p->dato)
return p;
else
if (n<p->dato)
return (buscar_nodo(p->hi,n));
else
return (buscar_nodo(p->hd,n));
}
void eliminar(struct nodo *tree,struct nodo *aux){
if (aux==NULL){
printf ("El nodo no existe");getch();
}
else{
if (aux->hi==NULL && aux->hd==NULL && aux->padre!=aux){
if((aux->padre)->hi==aux)
(aux->padre)->hi=NULL;
else
if((aux->padre)->hd==aux)
(aux->padre)->hd=NULL;
}
else
if(aux->padre==aux && aux->hi==NULL && aux->hd==NULL)
tree=NULL;
else
eliminar_nodo(&tree,aux);
free(aux);
listar_ird(tree);getch();
}
}
void eliminar_nodo(struct nodo**p,struct nodo*q){
if (q->padre!=q){
if (q->hi!=NULL){
if((q->hi)->hd==NULL){
if ((q->padre)->hd==q)
(q->padre)->hd=q->hi;
else
if((q->padre)->hi==q)
(q->padre)->hi=q->hi;
(q->hi)->padre=q->padre;
(q->hi)->hd=q->hd;
if (q->hd!=NULL)
((q->hi)->hd)->padre=q->hi;
}
else{
struct nodo *aux=NULL;
if ((aux=(struct nodo *)malloc(sizeof(struct nodo)))==NULL){
clrscr();
printf ("No hay memoria suficiente.");
getch();
exit(1);
}
else{
aux=(q->hi)->hd;
while(aux->hd!=NULL)
aux=aux->hd;
if (aux->hi!=NULL)
eliminar_nodo(p,aux);
else
if ((aux->padre)->hd==aux)
(aux->padre)->hd=NULL;
else
if((aux->padre)->hi==aux)
(aux->padre)->hi=NULL;
// else
// if ((q->hd)->hd==aux)
// (q->hd)->hd=NULL;
// else
// if((q->hd)->hi==aux)
// (q->hd)->hi=NULL;
if ((q->padre)->hd==q)
(q->padre)->hd=aux;
else
if ((q->padre)->hi==q)
(q->padre)->hi=aux;
aux->padre=q->padre;
aux->hi=q->hi;
if (aux->hi!=NULL)
(aux->hi)->padre=aux;
aux->hd=q->hd;
if (aux->hd!=NULL)
(aux->hd)->padre=aux;
}
}
}
else{
if (q->hd!=NULL){
if((q->hd)->hi==NULL){
if ((q->padre)->hd==q)
(q->padre)->hd=q->hd;
else
if((q->padre)->hi==q)
(q->padre)->hi=q->hd;
(q->hd)->padre=q->padre;
(q->hd)->hi=q->hi;
if (q->hi!=NULL)
((q->hd)->hi)->padre=q->hd;
}
else{
struct nodo *aux=NULL;
if ((aux=(struct nodo *)malloc(sizeof(struct nodo)))==NULL){
clrscr();
printf ("No hay memoria suficiente.");
getch();
exit(1);
}
else{
aux=(q->hd)->hi;
while(aux->hi!=NULL)
aux=aux->hi;
if (aux->hd!=NULL)
eliminar_nodo(p,aux);
else
if ((aux->padre)->hd==aux)
(aux->padre)->hd=NULL;
else
if((aux->padre)->hi==aux)
(aux->padre)->hi=NULL;
// else
// if ((q->hd)->hd==aux)
// (q->hd)->hd=NULL;
// else
// if((q->hd)->hi==aux)
// (q->hd)->hi=NULL;
if ((q->padre)->hd==q)
(q->padre)->hd=aux;
else
if ((q->padre)->hi==q)
(q->padre)->hi=aux;
aux->padre=q->padre;
aux->hi=q->hi;
if (aux->hi!=NULL)
(aux->hi)->padre=aux;
aux->hd=q->hd;
if (aux->hd!=NULL)
(aux->hd)->padre=aux;
}
}
}
}
}
else{
if (q->hi!=NULL){
if((q->hi)->hd==NULL){
(q->hi)->hd=(*p)->hd;
(*p)=q->hi;
(q->hi)->padre=q->hi;
}
else{
struct nodo *aux=NULL;
if ((aux=(struct nodo *)malloc(sizeof(struct nodo)))==NULL){
clrscr();
printf ("No hay memoria suficiente.");
getch();
exit(1);
}
else{
aux=(q->hi)->hd;
while(aux->hd!=NULL)
aux=aux->hd;
if (aux->hi!=NULL)
eliminar_nodo(p,aux);
(*p)=aux;
aux->padre=aux;
aux->hi=q->hi;
if (aux->hi!=NULL)
(aux->hi)->padre=aux;
aux->hd=q->hd;
if (aux->hd!=NULL)
(aux->hd)->padre=aux;
}
}
}
else{
if (q->hd!=NULL){
if((q->hd)->hi==NULL){
(*p)=q->hd;
(q->hd)->padre=q->hd;
}
else{
struct nodo *aux=NULL;
if ((aux=(struct nodo *)malloc(sizeof(struct nodo)))==NULL){
clrscr();
printf ("No hay memoria suficiente.");
getch();
exit(1);
}
else{
aux=(q->hd)->hi;
while(aux->hi!=NULL)
aux=aux->hi;
if (aux->hd!=NULL)
eliminar_nodo(p,aux);
(*p)=aux;
if ((aux->padre)->hd==aux)
(aux->padre)->hd=NULL;
else
if((aux->padre)->hi==aux)
(aux->padre)->hi=NULL;
aux->padre=aux;
aux->hi=q->hi;
if (aux->hi!=NULL)
(aux->hi)->padre=aux;
aux->hd=q->hd;
if (aux->hd!=NULL)
(aux->hd)->padre=aux;
}
}
}
}
}
}

103
CPP/ARCON.CPP Normal file
View File

@ -0,0 +1,103 @@
#include <stdio.h>
#include <conio.h>
#include <iostream.h>
#include <alloc.h>
#include <stdlib.h>
struct nodo {
int dato;
struct nodo *padre;
struct nodo *hi;
struct nodo *hd;
};
int ARBOL_VACIO (struct nodo *);
void INI_ARBOL (struct nodo **);
void INS_ARBOL (struct nodo **, int);
int LISTAR_IRD (struct nodo *);
void main (void) {
int d;
struct nodo *arbol;
INI_ARBOL(&arbol);
for (int i=0; i<37; i++) {
printf("\n Introduce n<>mero: ");
fflush (stdin);
scanf ("%d", &d);
INS_ARBOL(&arbol, d);
}
printf("Numero de niveles -> %d",LISTAR_IRD(arbol));
getch();
free (arbol);
}
int ARBOL_VACIO(struct nodo *p) {
if (p == NULL)
return (1);
else
return (0);
}
void INI_ARBOL(struct nodo **p) { *p = NULL; }
void INS_ARBOL(struct nodo **p, int n) {
struct nodo *aux;
struct nodo **q;
int sw;
if ((aux = (struct nodo*) malloc (sizeof (struct nodo)))== NULL)
exit(1);
aux -> dato = n;
if (ARBOL_VACIO(*p)) {
aux -> hi = NULL;
aux -> hd = NULL;
aux -> padre = aux;
*p = aux;
}
else {
sw = 1;
q = p;
while (sw) {
sw = 0;
if ((*q) -> dato <= n && (*q) -> hd != NULL) {
q = &(*q) -> hd;
sw = 1;
}
if ((*q) -> dato >= n && (*q) -> hi != NULL) {
q = &(*q) -> hi;
sw = 1;
}
}
aux -> hi = aux -> hd = NULL;
aux -> padre = (*q);
((*q) -> dato < n) ? (*q) -> hd = aux : (*q) -> hi = aux;
}
}
int LISTAR_IRD(struct nodo *p) {
static int max=0;
static int nivel=1;
if (p != NULL)
{
nivel++;LISTAR_IRD(p -> hi);
if (nivel>max)
max=nivel;
nivel--;
//printf (" %d ", p -> dato);
nivel++;LISTAR_IRD(p -> hd);
nivel--;
if (nivel>max)
max=nivel;
}
return (max-1);
}

101
CPP/BASE.C Normal file
View File

@ -0,0 +1,101 @@
#include <stdio.h>
#include <conio.h>
int digitos,baseini,basefinal,num,numfinal,tabla[80],tabla_bien[80];
int Pedir_Base();
int Pedir_Num(int baseini);
int BaseDiez_Base(int num,int basefinal);
int Transform(int num);
void Imprimir_tabla(int digitos);
void main() {
clrscr();
baseini=Pedir_Base();
num=Pedir_Num(baseini);
basefinal=Pedir_Base();
digitos=BaseDiez_Base(num,basefinal);
Imprimir_tabla(digitos);
printf("\nPulse una tecla para finalizar ...");
getch();
}
int Pedir_Base() {
int b;
do {
printf("\nIntroduce la Base: ");
fflush(stdin);
scanf("%d",&b);
} while (b<2 || b>16);
return(b);
}
int Pedir_Num(int baseini) {
int seguir=1,k=0,nuevo=0,numero;char n=0;
printf("Introduce un n<>mero: ");
while (seguir) {
fflush(stdin); cscanf("%1c",&n);
if (n==13)
seguir=0;
else
k=Transform(n);
if (seguir)
if (k<baseini) {
numero=nuevo+k;
nuevo=numero*baseini;
}
else {
gotoxy(wherex()-1,wherey());
printf(" ");
gotoxy(wherex()-1,wherey());
}
}
return (numero);
}
int BaseDiez_Base(int num,int basefinal) {
int n=0,con=0,resto=0,pos=0,i=0,digitos=0;
n=num; con=0;
while (n!=0) {
resto=(n%basefinal);
n=(n/basefinal);
tabla[con]=resto;
printf("\n guardo en tabla[%d]=%d",con,resto);
digitos=con;
con++;
}
pos=0;i=(con-1);
for (i;i>=0;i--) {
tabla_bien[pos]=tabla[i];
printf("\ntablabien[%d]=%d",i,tabla_bien[pos]);
pos++;
}
return(digitos);
}
int Transform(int num) {
int k=0;
if (num>=48 && num <=57)
k=(num-48);
else
if (num>=65 && num <=70)
k=(num-55);
else
if (num>=97 && num <=102)
k=(num-87);
else
k=99;
return(k);
}
void Imprimir_tabla(int digitos) {
//printf("\n llegan digitos=%d\n",digitos);
printf("\nEl n<>mero pedido es: ");
for (int i=0;i<=digitos;i++)
printf("%x",tabla_bien[i]);
}

101
CPP/BASE.CPP Normal file
View File

@ -0,0 +1,101 @@
#include <stdio.h>
#include <conio.h>
int digitos,baseini,basefinal,num,numfinal,tabla[80],tabla_bien[80];
int Pedir_Base();
int Pedir_Num(int baseini);
int BaseDiez_Base(int num,int basefinal);
int Transform(int num);
void Imprimir_tabla(int digitos);
void main() {
clrscr();
baseini=Pedir_Base();
num=Pedir_Num(baseini);
basefinal=Pedir_Base();
digitos=BaseDiez_Base(num,basefinal);
Imprimir_tabla(digitos);
printf("\nPulse una tecla para finalizar ...");
getch();
}
int Pedir_Base() {
int b;
do {
printf("\nIntroduce la Base: ");
fflush(stdin);
scanf("%d",&b);
} while (b<2 || b>16);
return(b);
}
int Pedir_Num(int baseini) {
int seguir=1,k=0,nuevo=0,numero;char n=0;
printf("Introduce un n<>mero: ");
while (seguir) {
fflush(stdin); cscanf("%1c",&n);
if (n==13)
seguir=0;
else
k=Transform(n);
if (seguir)
if (k<baseini) {
numero=nuevo+k;
nuevo=numero*baseini;
}
else {
gotoxy(wherex()-1,wherey());
printf(" ");
gotoxy(wherex()-1,wherey());
}
}
return (numero);
}
int BaseDiez_Base(int num,int basefinal) {
int n=0,con=0,resto=0,pos=0,i=0,digitos=0;
n=num; con=0;
while (n!=0) {
resto=(n%basefinal);
n=(n/basefinal);
tabla[con]=resto;
printf("\n guardo en tabla[%d]=%d",con,resto);
digitos=con;
con++;
}
pos=0;i=(con-1);
for (i;i>=0;i--) {
tabla_bien[pos]=tabla[i];
printf("\ntablabien[%d]=%d",i,tabla_bien[pos]);
pos++;
}
return(digitos);
}
int Transform(int num) {
int k=0;
if (num>=48 && num <=57)
k=(num-48);
else
if (num>=65 && num <=70)
k=(num-55);
else
if (num>=97 && num <=102)
k=(num-87);
else
k=99;
return(k);
}
void Imprimir_tabla(int digitos) {
//printf("\n llegan digitos=%d\n",digitos);
printf("\nEl n<>mero pedido es: ");
for (int i=0;i<=digitos;i++)
printf("%x",tabla_bien[i]);
}

94
CPP/BUENO.CPP Normal file
View File

@ -0,0 +1,94 @@
// Minicalculator<6F> Ver 2.1
// Copyright 1998
//
// Descripci<63>n del programa:
// Este programa pide dos n<>meros, luego muestra un men<65> y dependiendo
// de la opci<63>n elegida los suma, resta, multiplica o divide imprimiendo
// el resultado de la operaci<63>n.
//
// Programadores:
// Juan L<>pez Fern<72>ndez
// Mois<69>s Virumbrales Cuenca
// Grupo 1<>A
//
// Novedades de la Versi<73>n 2.1
// Presenta un mensaje de error si la opci<63>n no est<73> en el men<65>
// o si la divisi<73>n es por cero. Adem<65>s cuando la divisi<73>n no es exacta
// se imprime el resto. Tambi<62>n se ha mejorado la interface con el usuario.
//
// Creado: 3-11-1998
// <20>ltima modificaci<63>n: 10-11-1998
#include <conio.h>
#include <stdio.h>
int a,b,c;
char pausa;
void main ()
{
clrscr();
printf ("\n\t\t\t Minicalculator<6F> Ver 2.1");
printf ("\n\t\t\t <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
printf ("\n\n\n\n\t\t Introduce primer n<>mero: ");
fflush (stdin);
scanf ("%d",&a);
printf ("\n\n\t\t Introduce segundo n<>mero: ");
fflush (stdin);
scanf ("%d",&b);
clrscr();
printf ("\n\t\t\t Minicalculator<6F> Ver 2.1");
printf ("\n\t\t\t <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
printf ("\n\n\n\t\t\t Men<65> de opciones");
printf ("\n\n\t\t 1.- Sumar los n<>meros introducidos.");
printf ("\n\t\t 2.- Restar los n<>meros introducidos.");
printf ("\n\t\t 3.- Multiplicar los n<>meros introducidos.");
printf ("\n\t\t 4.- Dividir los n<>meros introducidos.");
printf ("\n\n\t\t Opci<63>n deseada: ");
fflush(stdin);
scanf ("%d",&c);
if (c==1)
{
printf ("\n\t\t La suma de los n<>meros (%d+%d) es: %d",a,b,a+b);
}
else
{
if (c==2)
{
printf ("\n\t\t La resta de los n<>meros (%d-%d) es: %d",a,b,a-b);
}
else
{
if (c==3)
{
printf ("\n\t\t La multiplicaci<63>n de los n<>meros (%d*%d) es: %d",a,b,a*b);
}
else
{
if (c==4)
{
if (b==0)
{
printf ("\n\t\t <20><> Error !!, no se puede dividir por cero.");
}
else
{
printf ("\n\t\t La divisi<73>n de los n<>meros (%d/%d) es: %d",a,b,a/b);
if (a%b!=0)
{
printf (" Resto: %d",a%b);
}
}
}
else
{
printf ("\n\n\t\t\t<EFBFBD><EFBFBD> Opci<63>n incorrecta !!");
}
}
}
}
printf ("\n\n\n\n\n\n\n\n\n Pulse ENTER para finalizar...");
fflush(stdin);
scanf("%c",&pausa);
}

146
CPP/CONIO.H Normal file
View File

@ -0,0 +1,146 @@
/* conio.h
Direct MSDOS console input/output.
Copyright (c) 1987, 1991 by Borland International
All Rights Reserved.
*/
#if !defined(__CONIO_H)
#define __CONIO_H
#if !defined(__DEFS_H)
#include <_defs.h>
#endif
#define _NOCURSOR 0
#define _SOLIDCURSOR 1
#define _NORMALCURSOR 2
struct text_info {
unsigned char winleft;
unsigned char wintop;
unsigned char winright;
unsigned char winbottom;
unsigned char attribute;
unsigned char normattr;
unsigned char currmode;
unsigned char screenheight;
unsigned char screenwidth;
unsigned char curx;
unsigned char cury;
};
enum text_modes { LASTMODE=-1, BW40=0, C40, BW80, C80, MONO=7, C4350=64 };
#if !defined(__COLORS)
#define __COLORS
enum COLORS {
BLACK, /* dark colors */
BLUE,
GREEN,
CYAN,
RED,
MAGENTA,
BROWN,
LIGHTGRAY,
DARKGRAY, /* light colors */
LIGHTBLUE,
LIGHTGREEN,
LIGHTCYAN,
LIGHTRED,
LIGHTMAGENTA,
YELLOW,
WHITE
};
#endif
#define BLINK 128 /* blink bit */
extern int _Cdecl directvideo;
extern int _Cdecl _wscroll;
#ifdef __cplusplus
extern "C" {
#endif
void _Cdecl clreol( void );
void _Cdecl clrscr( void );
void _Cdecl gotoxy( int __x, int __y );
int _Cdecl wherex( void );
int _Cdecl wherey( void );
int _Cdecl getch( void );
int _Cdecl getche( void );
int _Cdecl kbhit( void );
int _Cdecl putch( int __c );
#ifndef _PORT_DEFS
int _Cdecl inp( unsigned __portid );
unsigned _Cdecl inpw( unsigned __portid );
int _Cdecl outp( unsigned __portid, int __value );
unsigned _Cdecl outpw( unsigned __portid, unsigned __value );
unsigned char _Cdecl inportb( int __portid );
void _Cdecl outportb( int __portid, unsigned char __value );
#endif /* !_PORT_DEFS */
int _Cdecl inport( int __portid );
void _Cdecl outport( int __portid, int __value );
void _Cdecl delline( void );
int _Cdecl gettext( int __left, int __top,
int __right, int __bottom,
void *__destin);
void _Cdecl gettextinfo (struct text_info *__r );
void _Cdecl highvideo( void );
void _Cdecl insline( void );
void _Cdecl lowvideo( void );
int _Cdecl movetext( int __left, int __top,
int __right, int __bottom,
int __destleft, int __desttop );
void _Cdecl normvideo( void );
int _Cdecl puttext( int __left, int __top,
int __right, int __bottom,
void *__source );
void _Cdecl textattr( int __newattr );
void _Cdecl textbackground( int __newcolor );
void _Cdecl textcolor( int __newcolor );
void _Cdecl textmode( int __newmode );
void _Cdecl window( int __left, int __top, int __right, int __bottom);
void _Cdecl _setcursortype( int __cur_t );
char * _Cdecl cgets( char *__str );
int _Cdecl cprintf( const char *__format, ... );
int _Cdecl cputs( const char *__str );
int _Cdecl cscanf( const char *__format, ... );
char * _Cdecl getpass( const char *__prompt );
int _Cdecl ungetch( int __ch );
#ifndef _PORT_DEFS
#define _PORT_DEFS
/* These are in-line functions. These prototypes just clean up
some syntax checks and code generation.
*/
unsigned char _Cdecl __inportb__( int __portid );
unsigned int _Cdecl __inportw__( int __portid );
void _Cdecl __outportb__( int __portid, unsigned char __value );
void _Cdecl __outportw__( int __portid, unsigned int __value );
#define inportb __inportb__
#define inportw __inportw__
#define outportb __outportb__
#define outportw __outportw__
#define inp( portid ) __inportb__( portid )
#define outp( portid,v ) (__outportb__( portid,v ), (int)_AL)
#define inpw( portid ) __inportw__( portid )
#define outpw( portid,v ) (__outportw__( portid,v ), (unsigned)_AX)
#endif /* _PORT_DEFS */
#ifdef __cplusplus
}
#endif
#endif /* __CONIO_H */

126
CPP/CURSOR.BAK Normal file
View File

@ -0,0 +1,126 @@
#include <stdio.h>
char i = 0, a = 0;
int col, sw = 0;
int fil;
void main () {
clrscr ();
fflush (stdin);
gotoxy (10, 10);
printf ("Mueve cursor:");
while (sw == 0) {
//gotoxy(wherex(),wherey());
i = getche ();
col = wherex ();
col--;
fil = wherey ();
if (i == 0)
{
//printf("dentro de i=0");
a = getch ();
switch (a)
{
case 72:
{
gotoxy (col, fil - 1);
// printf("col= %d, fil= %d",col,fil);
// getch();
break;
}
case 80:
gotoxy (col, fil + 1);
break;
case 77:
gotoxy (col + 1, fil);
break;
case 75:
gotoxy (col - 1, fil);
break;
}
// getch();
}
else
sw = 1;
}
printf ("fin");
getch ();
fflush (stdin);
clrscr ();
}

91
CPP/CURSOR.C Normal file
View File

@ -0,0 +1,91 @@
#include <stdio.h>
char i = 0, a = 0;
int col, sw = 0;
int fil;
void main () {
clrscr ();
fflush (stdin);
gotoxy (10, 10);
printf ("Mueve cursor:");
while (sw == 0) {
/*gotoxy(wherex(),wherey());*/
i = getche ();
col = wherex ();
col--;
fil = wherey ();
if (i == 0) {
/* //printf("dentro de i=0");*/
a = getch ();
switch (a) {
case 72: {
gotoxy (col, fil - 1);
/* // printf("col= %d, fil= %d",col,fil);*/
/* // getch();*/
break;
}
case 80:
gotoxy (col, fil + 1);
break;
case 77:
gotoxy (col + 1, fil);
break;
case 75:
gotoxy (col - 1, fil);
break;
}
}
else
sw = 1;
}
printf ("fin");
getch ();
fflush (stdin);
clrscr ();
}

54
CPP/CURSOR.CPP Normal file
View File

@ -0,0 +1,54 @@
#include <stdio.h>
#include <conio.h>
char i=0, a=0;
int col,sw=0;
int fil;
void main()
{
clrscr();
fflush(stdin);
gotoxy(10,10);
printf("Mueve cursor:");
while(sw==0)
{
//gotoxy(wherex(),wherey());
i=getche();
col=wherex();
col--;
fil=wherey();
if(i==0)
{
//printf("dentro de i=0");
a=getch();
switch(a)
{
case 72:
{
gotoxy(col,fil-1);
// printf("col= %d, fil= %d",col,fil);
// getch();
break;
}
case 80:
gotoxy(col,fil+1);
break;
case 77:
gotoxy(col+1,fil);
break;
case 75:
gotoxy(col-1,fil);
break;
}
// getch();
}
else
sw=1;
}
printf("fin");
getch();
fflush(stdin);
clrscr();
}

0
CPP/CURSOR.H Normal file
View File

BIN
CPP/CURSOR.O Normal file

Binary file not shown.

91
CPP/CURSOR~1.ESV Normal file
View File

@ -0,0 +1,91 @@
#include <stdio.h>
char i = 0, a = 0;
int col, sw = 0;
int fil;
void main () {
clrscr ();
fflush (stdin);
gotoxy (10, 10);
printf ("Mueve cursor:");
while (sw == 0) {
/*gotoxy(wherex(),wherey());*/
i = getche ();
col = wherex ();
col--;
fil = wherey ();
if (i == 0) {
/* //printf("dentro de i=0");*/
a = getch ();
switch (a) {
case 72: {
gotoxy (col, fil - 1);
/* // printf("col= %d, fil= %d",col,fil);*/
/* // getch();*/
break;
}
case 80:
gotoxy (col, fil + 1);
break;
case 77:
gotoxy (col + 1, fil);
break;
case 75:
gotoxy (col - 1, fil);
break;
}
}
else
sw = 1;
}
printf ("fin");
getch ();
fflush (stdin);
clrscr ();
}

148
CPP/DAMAS.BAK Normal file
View File

@ -0,0 +1,148 @@
#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include <k:\pruebas\mouse15\mouse.h>
int huge detectEGA(void);
void main(){
int gdriver = DETECT, gmode, errorcode;
gdriver = installuserdriver("svga256",detectEGA);
initgraph(&gdriver, &gmode, "c:\\tc\\bgi");
errorcode = graphresult();
if (errorcode != grOk){
printf("Error al iniciar el modo gr<67>fico: %s\n", grapherrormsg(errorcode));
printf("Pulse cualquier tecla para finalizar...");
getch();
exit(1);
}
MouseInit();
MShowCursor();
setcolor(1);
rectangle(-1,-1,640,480);setfillstyle(9,1);floodfill(2,2,1);
setcolor(15);
rectangle(288,88,612,412);rectangle(290,90,610,410);
int i=0;
for (i=1;i<9;i++)
line(290+(i*40),90,290+(i*40),410);
for (i=1;i<9;i++)
line(290,90+(i*40),610,90+(i*40));
for (int y=90,con=1,con2=1;y<410;y=y+40,con2++)
for (int x=290;x<610;x=x+40,con++){
if (con%2==0 && con2%2!=0)
setfillstyle(1,6);
else
if (con%2!=0 && con2%2==0)
setfillstyle(1,6);
else
setfillstyle(1,14);
floodfill(x+1,y+1,15);
}
for (y=110,con=1,con2=1;y<230;y=y+40,con2++)
for (i=310;i<610;i=i+40,con++)
if ((con%2==0 && con2%2!=0) || (con%2!=0 && con2%2==0)){
setcolor(0);setfillstyle(1,0);circle(i,y,10);floodfill(i,y,0);
}
for (y=310,con=1,con2=6;y<410;y=y+40,con2++)
for (i=310;i<610;i=i+40,con++)
if ((con%2==0 && con2%2!=0) || (con%2!=0 && con2%2==0)){
setcolor(15);setfillstyle(1,15);circle(i,y,10);floodfill(i,y,15);
}
int sw=0,cursor=0,col=0,fil=0,a=0,color=6;
col=370;fil=210;setcolor(13);rectangle(col+1,fil+1,col+39,fil+39);
rectangle(col+2,fil+2,col+38,fil+38);rectangle(col+3,fil+3,col+37,fil+37);
while(sw==0){
cursor=getche();
if (cursor!=13){
setcolor(color);rectangle(col+1,fil+1,col+39,fil+39);
rectangle(col+2,fil+2,col+38,fil+38);rectangle(col+3,fil+3,col+37,fil+37);
}
if(cursor==0){
a=getch();
switch(a){
case 72:
if (col>289 && col<571 && fil>89 && fil<371){
fil=fil-40;
if (fil<89)
fil=fil+40;
color=getpixel(col+1,fil+1);
setcolor(13);rectangle(col+1,fil+1,col+39,fil+39);
rectangle(col+2,fil+2,col+38,fil+38);
rectangle(col+3,fil+3,col+37,fil+37);
}
break;
case 80:
if (col>289 && col<571 && fil>89 && fil<371){
fil=fil+40;
if (fil>371)
fil=fil-40;
color=getpixel(col+1,fil+1);
setcolor(13);rectangle(col+1,fil+1,col+39,fil+39);
rectangle(col+2,fil+2,col+38,fil+38);
rectangle(col+3,fil+3,col+37,fil+37);
}
break;
case 77:
if (col>289 && col<571 && fil>89 && fil<371){
col=col+40;
if (col>571)
col=col-40;
color=getpixel(col+1,fil+1);
setcolor(13);rectangle(col+1,fil+1,col+39,fil+39);
rectangle(col+2,fil+2,col+38,fil+38);
rectangle(col+3,fil+3,col+37,fil+37);
}
break;
case 75:
if (col>289 && col<571 && fil>89 && fil<371){
col=col-40;
if (col<289)
col=col+40;
color=getpixel(col+1,fil+1);
setcolor(13);rectangle(col+1,fil+1,col+39,fil+39);
rectangle(col+2,fil+2,col+38,fil+38);
rectangle(col+3,fil+3,col+37,fil+37);
}
break;
}
}
else
if (cursor==13){
int color2=0;
color2=getpixel(col+20,fil+20);
setcolor(color);setfillstyle(1,color);floodfill(col+20,fil+20,color);
circle(col+20,fil+20,color);
setcolor(8);setfillstyle(1,8);circle(col+22,fil+22,10);
floodfill(col+22,fil+22,8);
setcolor(color2);setfillstyle(1,color2);circle(col+18,fil+18,10);
floodfill(col+18,fil+18,color2);
col=370;fil=210;setcolor(13);rectangle(col+1,fil+1,col+39,fil+39);
rectangle(col+2,fil+2,col+38,fil+38);
rectangle(col+3,fil+3,col+37,fil+37);
}
else
sw=1;
}
getch();
MouseClose();
closegraph();
}
/* detects EGA or VGA cards */
int huge detectEGA(void)
{
int driver, mode, sugmode = 0;
sugmode++;
detectgraph(&driver, &mode);
if ((driver == EGA) || (driver == VGA))
/* return suggested video mode number */
return 1;
else
/* return an error code */
return grError;
}

126
CPP/DAMAS.CPP Normal file
View File

@ -0,0 +1,126 @@
#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
void main(){
int gdriver = DETECT, gmode, errorcode;
initgraph(&gdriver, &gmode, "d:\\tc\\bgi");
errorcode = graphresult();
if (errorcode != grOk){
printf("Error al iniciar el modo gr<67>fico: %s\n", grapherrormsg(errorcode));
printf("Pulse cualquier tecla para finalizar...");
getch();
exit(1);
}
setcolor(1);
rectangle(-1,-1,640,480);setfillstyle(9,1);floodfill(2,2,1);
setcolor(15);
rectangle(288,88,612,412);rectangle(290,90,610,410);
int i=0;
for (i=1;i<9;i++)
line(290+(i*40),90,290+(i*40),410);
for (i=1;i<9;i++)
line(290,90+(i*40),610,90+(i*40));
for (int y=90,con=1,con2=1;y<410;y=y+40,con2++)
for (int x=290;x<610;x=x+40,con++){
if (con%2==0 && con2%2!=0)
setfillstyle(1,6);
else
if (con%2!=0 && con2%2==0)
setfillstyle(1,6);
else
setfillstyle(1,14);
floodfill(x+1,y+1,15);
}
for (y=110,con=1,con2=1;y<230;y=y+40,con2++)
for (i=310;i<610;i=i+40,con++)
if ((con%2==0 && con2%2!=0) || (con%2!=0 && con2%2==0)){
setcolor(0);setfillstyle(1,0);circle(i,y,10);floodfill(i,y,0);
}
for (y=310,con=1,con2=6;y<410;y=y+40,con2++)
for (i=310;i<610;i=i+40,con++)
if ((con%2==0 && con2%2!=0) || (con%2!=0 && con2%2==0)){
setcolor(15);setfillstyle(1,15);circle(i,y,10);floodfill(i,y,15);
}
int sw=0,cursor=0,col=0,fil=0,a=0,color=6;
col=370;fil=210;setcolor(13);rectangle(col+1,fil+1,col+39,fil+39);
rectangle(col+2,fil+2,col+38,fil+38);rectangle(col+3,fil+3,col+37,fil+37);
while(sw==0){
cursor=getche();
if (cursor!=13){
setcolor(color);rectangle(col+1,fil+1,col+39,fil+39);
rectangle(col+2,fil+2,col+38,fil+38);rectangle(col+3,fil+3,col+37,fil+37);
}
if(cursor==0){
a=getch();
switch(a){
case 72:
if (col>289 && col<571 && fil>89 && fil<371){
fil=fil-40;
if (fil<89)
fil=fil+40;
color=getpixel(col+1,fil+1);
setcolor(13);rectangle(col+1,fil+1,col+39,fil+39);
rectangle(col+2,fil+2,col+38,fil+38);
rectangle(col+3,fil+3,col+37,fil+37);
}
break;
case 80:
if (col>289 && col<571 && fil>89 && fil<371){
fil=fil+40;
if (fil>371)
fil=fil-40;
color=getpixel(col+1,fil+1);
setcolor(13);rectangle(col+1,fil+1,col+39,fil+39);
rectangle(col+2,fil+2,col+38,fil+38);
rectangle(col+3,fil+3,col+37,fil+37);
}
break;
case 77:
if (col>289 && col<571 && fil>89 && fil<371){
col=col+40;
if (col>571)
col=col-40;
color=getpixel(col+1,fil+1);
setcolor(13);rectangle(col+1,fil+1,col+39,fil+39);
rectangle(col+2,fil+2,col+38,fil+38);
rectangle(col+3,fil+3,col+37,fil+37);
}
break;
case 75:
if (col>289 && col<571 && fil>89 && fil<371){
col=col-40;
if (col<289)
col=col+40;
color=getpixel(col+1,fil+1);
setcolor(13);rectangle(col+1,fil+1,col+39,fil+39);
rectangle(col+2,fil+2,col+38,fil+38);
rectangle(col+3,fil+3,col+37,fil+37);
}
break;
}
}
else
if (cursor==13){
int color2=0;
color2=getpixel(col+20,fil+20);
setcolor(color);setfillstyle(1,color);floodfill(col+20,fil+20,color);
circle(col+20,fil+20,color);
setcolor(8);setfillstyle(1,8);circle(col+22,fil+22,10);
floodfill(col+22,fil+22,8);
setcolor(color2);setfillstyle(1,color2);circle(col+18,fil+18,10);
floodfill(col+18,fil+18,color2);
col=370;fil=210;setcolor(13);rectangle(col+1,fil+1,col+39,fil+39);
rectangle(col+2,fil+2,col+38,fil+38);
rectangle(col+3,fil+3,col+37,fil+37);
}
else
sw=1;
}
getch();
closegraph();
}

148
CPP/DAMAS.~C Normal file
View File

@ -0,0 +1,148 @@
#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include <k:\pruebas\mouse15\mouse.h>
int huge detectEGA(void);
void main(){
int gdriver = DETECT, gmode, errorcode;
gdriver = installuserdriver("egavga",detectEGA);
initgraph(&gdriver, &gmode, "c:\\tc\\bgi");
errorcode = graphresult();
if (errorcode != grOk){
printf("Error al iniciar el modo gr<67>fico: %s\n", grapherrormsg(errorcode));
printf("Pulse cualquier tecla para finalizar...");
getch();
exit(1);
}
MouseInit();
MShowCursor();
setcolor(1);
rectangle(-1,-1,640,480);setfillstyle(9,1);floodfill(2,2,1);
setcolor(15);
rectangle(288,88,612,412);rectangle(290,90,610,410);
int i=0;
for (i=1;i<9;i++)
line(290+(i*40),90,290+(i*40),410);
for (i=1;i<9;i++)
line(290,90+(i*40),610,90+(i*40));
for (int y=90,con=1,con2=1;y<410;y=y+40,con2++)
for (int x=290;x<610;x=x+40,con++){
if (con%2==0 && con2%2!=0)
setfillstyle(1,6);
else
if (con%2!=0 && con2%2==0)
setfillstyle(1,6);
else
setfillstyle(1,14);
floodfill(x+1,y+1,15);
}
for (y=110,con=1,con2=1;y<230;y=y+40,con2++)
for (i=310;i<610;i=i+40,con++)
if ((con%2==0 && con2%2!=0) || (con%2!=0 && con2%2==0)){
setcolor(0);setfillstyle(1,0);circle(i,y,10);floodfill(i,y,0);
}
for (y=310,con=1,con2=6;y<410;y=y+40,con2++)
for (i=310;i<610;i=i+40,con++)
if ((con%2==0 && con2%2!=0) || (con%2!=0 && con2%2==0)){
setcolor(15);setfillstyle(1,15);circle(i,y,10);floodfill(i,y,15);
}
int sw=0,cursor=0,col=0,fil=0,a=0,color=6;
col=370;fil=210;setcolor(13);rectangle(col+1,fil+1,col+39,fil+39);
rectangle(col+2,fil+2,col+38,fil+38);rectangle(col+3,fil+3,col+37,fil+37);
while(sw==0){
cursor=getche();
if (cursor!=13){
setcolor(color);rectangle(col+1,fil+1,col+39,fil+39);
rectangle(col+2,fil+2,col+38,fil+38);rectangle(col+3,fil+3,col+37,fil+37);
}
if(cursor==0){
a=getch();
switch(a){
case 72:
if (col>289 && col<571 && fil>89 && fil<371){
fil=fil-40;
if (fil<89)
fil=fil+40;
color=getpixel(col+1,fil+1);
setcolor(13);rectangle(col+1,fil+1,col+39,fil+39);
rectangle(col+2,fil+2,col+38,fil+38);
rectangle(col+3,fil+3,col+37,fil+37);
}
break;
case 80:
if (col>289 && col<571 && fil>89 && fil<371){
fil=fil+40;
if (fil>371)
fil=fil-40;
color=getpixel(col+1,fil+1);
setcolor(13);rectangle(col+1,fil+1,col+39,fil+39);
rectangle(col+2,fil+2,col+38,fil+38);
rectangle(col+3,fil+3,col+37,fil+37);
}
break;
case 77:
if (col>289 && col<571 && fil>89 && fil<371){
col=col+40;
if (col>571)
col=col-40;
color=getpixel(col+1,fil+1);
setcolor(13);rectangle(col+1,fil+1,col+39,fil+39);
rectangle(col+2,fil+2,col+38,fil+38);
rectangle(col+3,fil+3,col+37,fil+37);
}
break;
case 75:
if (col>289 && col<571 && fil>89 && fil<371){
col=col-40;
if (col<289)
col=col+40;
color=getpixel(col+1,fil+1);
setcolor(13);rectangle(col+1,fil+1,col+39,fil+39);
rectangle(col+2,fil+2,col+38,fil+38);
rectangle(col+3,fil+3,col+37,fil+37);
}
break;
}
}
else
if (cursor==13){
int color2=0;
color2=getpixel(col+20,fil+20);
setcolor(color);setfillstyle(1,color);floodfill(col+20,fil+20,color);
circle(col+20,fil+20,color);
setcolor(8);setfillstyle(1,8);circle(col+22,fil+22,10);
floodfill(col+22,fil+22,8);
setcolor(color2);setfillstyle(1,color2);circle(col+18,fil+18,10);
floodfill(col+18,fil+18,color2);
col=370;fil=210;setcolor(13);rectangle(col+1,fil+1,col+39,fil+39);
rectangle(col+2,fil+2,col+38,fil+38);
rectangle(col+3,fil+3,col+37,fil+37);
}
else
sw=1;
}
getch();
MouseClose();
closegraph();
}
/* detects EGA or VGA cards */
int huge detectEGA(void)
{
int driver, mode, sugmode = 0;
sugmode++;
detectgraph(&driver, &mode);
if ((driver == EGA) || (driver == VGA))
/* return suggested video mode number */
return 4;
else
/* return an error code */
return grError;
}

32
CPP/DAMAS2.BAK Normal file
View File

@ -0,0 +1,32 @@
#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include <k:\pruebas\mouse15\mouse.h>
void main(){
int gdriver = DETECT, gmode, errorcode;
initgraph(&gdriver, &gmode, "c:\\tc\\bgi");
errorcode = graphresult();
if (errorcode != grOk){
printf("Error al iniciar el modo gr<67>fico: %s\n", grapherrormsg(errorcode));
printf("Pulse cualquier tecla para finalizar...");
getch();
exit(1);
}
setcolor(1);
rectangle(-1,-1,640,480);setfillstyle(9,1);floodfill(2,2,1);
// Pendiente 1/4 =80
setcolor(15);
setlinestyle(0,1,3);line(80,430,560,430);
setlinestyle(0,1,1);line(80,430,160,110);line(560,430,480,110);
line(160,110,480,110);
line(320,430,320,110);
line(260,430,280,110);line(200,430,240,110);line(140,430,200,110);
line(380,430,360,110);line(440,430,400,110);line(500,430,440,110);
line(150,150,490,150);
line(160,192,500,192);
// setfillstyle(1,14);floodfill(475,112,15);
getch();
closegraph();
}

31
CPP/DAMAS2.CPP Normal file
View File

@ -0,0 +1,31 @@
#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
void main(){
int gdriver = DETECT, gmode, errorcode;
initgraph(&gdriver, &gmode, "c:\\tc\\bgi");
errorcode = graphresult();
if (errorcode != grOk){
printf("Error al iniciar el modo gr<67>fico: %s\n", grapherrormsg(errorcode));
printf("Pulse cualquier tecla para finalizar...");
getch();
exit(1);
}
setcolor(1);
rectangle(-1,-1,640,480);setfillstyle(9,1);floodfill(2,2,1);
// Pendiente 1/4 =80
setcolor(15);
setlinestyle(0,1,3);line(80,430,560,430);
setlinestyle(0,1,1);line(80,430,160,110);line(560,430,480,110);
line(160,110,480,110);
line(320,430,320,110);
line(260,430,280,110);line(200,430,240,110);line(140,430,200,110);
line(380,430,360,110);line(440,430,400,110);line(500,430,440,110);
line(150,150,490,150);
line(160,192,500,192);
// setfillstyle(1,14);floodfill(475,112,15);
getch();
closegraph();
}

192
CPP/DIBPRUE.CPP Normal file
View File

@ -0,0 +1,192 @@
#include<stdio.h>
#include<conio.h>
char ventana (int ancho,int largo,int color_g,int color_borde,char titulo[],
int color_titulo,int posx,int posy);
void main() {
int cabeza[5][7],pelo[2][7],piernad[5][9],soga[12][7];
textbackground(0);
clrscr();
ventana(80,24,7,1,"Juego del Ahorcado",14,1,1);
// Pintar soga.
soga[0][3]='<EFBFBD>';soga[1][3]='<EFBFBD>';soga[2][3]='<EFBFBD>';soga[3][3]='<EFBFBD>';soga[4][3]='<EFBFBD>';
soga[5][2]='<EFBFBD>';soga[5][4]='<EFBFBD>';soga[6][1]='<EFBFBD>';soga[6][5]='<EFBFBD>';soga[7][0]='<EFBFBD>';
soga[7][6]='<EFBFBD>';soga[8][0]='<EFBFBD>';soga[8][6]='<EFBFBD>';soga[9][0]='<EFBFBD>';soga[9][6]='<EFBFBD>';
soga[10][1]='<EFBFBD>';soga[10][5]='<EFBFBD>';soga[11][2]='<EFBFBD>';soga[11][3]='<EFBFBD>';
soga[11][4]='<EFBFBD>';
for (int f=2,y=2;f<12;f++,y++) {
gotoxy(60,y);
for (int c=0;c<7;c++) {
if (soga[f][c]=='<EFBFBD>') {
textcolor(14);
cprintf ("%c",soga[f][c]);
}
else {
textcolor(7);
cprintf ("<EFBFBD>");
}
}
}
// pintar cabeza
cabeza[0][1]='<EFBFBD>';cabeza[0][2]='<EFBFBD>';cabeza[0][3]='<EFBFBD>';cabeza[0][4]='<EFBFBD>';
cabeza[0][5]='<EFBFBD>';cabeza[1][0]='<EFBFBD>';cabeza[1][1]='<EFBFBD>';cabeza[1][2]='<EFBFBD>';
cabeza[1][3]='<EFBFBD>';cabeza[1][4]='<EFBFBD>';cabeza[1][5]='<EFBFBD>';cabeza[1][6]='<EFBFBD>';
cabeza[2][0]='<EFBFBD>';cabeza[2][1]='<EFBFBD>';cabeza[2][2]='<EFBFBD>';cabeza[2][3]='<EFBFBD>';
cabeza[2][4]='<EFBFBD>';cabeza[2][5]='<EFBFBD>';cabeza[2][6]='<EFBFBD>';
cabeza[3][1]='<EFBFBD>';cabeza[3][2]='<EFBFBD>';cabeza[3][3]='<EFBFBD>';cabeza[3][4]='<EFBFBD>';
cabeza[3][5]='<EFBFBD>';cabeza[4][2]='<EFBFBD>';cabeza[4][3]='<EFBFBD>';cabeza[4][4]='<EFBFBD>';
for (f=0,y=6;f<5;f++,y++) {
gotoxy(60,y);
for (int c=0;c<7;c++) {
if (cabeza[f][c]=='<EFBFBD>') {
textcolor(6);
cprintf ("%c",cabeza[f][c]);
}
else {
textcolor(14);
cprintf ("<EFBFBD>");
}
}
}
// Pintar pelo
pelo[0][0]='<EFBFBD>';pelo[0][1]='<EFBFBD>';pelo[0][2]='<EFBFBD>';pelo[0][3]='<EFBFBD>';
pelo[0][4]='<EFBFBD>';pelo[0][5]='<EFBFBD>';pelo[0][6]='<EFBFBD>';pelo[1][0]='<EFBFBD>';
pelo[1][6]='<EFBFBD>';
for (f=0,y=5;f<2;f++,y++) {
gotoxy(60,y);
for (int c=0;c<7;c++) {
if (pelo[f][c]=='<EFBFBD>') {
textcolor(0);
cprintf ("%c",pelo[f][c]);
}
else {
textcolor(6);
cprintf ("<EFBFBD>");
}
}
}
// Pintar cara alegre.
// Pintar ojos
textbackground(6);textcolor(0);
gotoxy (62,7);cprintf ("O");
gotoxy (64,7);cprintf ("O");
// Pintar nariz.
gotoxy(63,8);cprintf("U");
// Pintar boca.
gotoxy(62,9);cprintf("<EFBFBD>");
gotoxy(64,9);cprintf("<EFBFBD>");
gotoxy(63,9);cprintf("-");
// Pintar cara triste.
// Pintar ojos
textbackground(6);textcolor(0);
gotoxy (62,7);cprintf ("*");
gotoxy (64,7);cprintf ("*");
// Pintar nariz.
gotoxy(63,8);cprintf("U");
// Pintar boca.
gotoxy(62,9);cprintf("+");
gotoxy(64,9);cprintf("+");
gotoxy(63,9);cprintf("+");
// Pintar cuerpo.
ventana(11,5,6,6,"",6,58,12);
// Pintar pierna.
piernad[0][0]='<EFBFBD>';piernad[0][1]='<EFBFBD>';piernad[0][2]='<EFBFBD>';piernad[0][3]='<EFBFBD>';
piernad[1][1]='<EFBFBD>';piernad[1][2]='<EFBFBD>';piernad[1][3]='<EFBFBD>';piernad[1][4]='<EFBFBD>';
piernad[2][2]='<EFBFBD>';piernad[2][3]='<EFBFBD>';piernad[2][4]='<EFBFBD>';piernad[2][5]='<EFBFBD>';
piernad[3][3]='<EFBFBD>';piernad[3][4]='<EFBFBD>';piernad[3][5]='<EFBFBD>';piernad[3][6]='<EFBFBD>';
piernad[4][4]='<EFBFBD>';piernad[4][5]='<EFBFBD>';piernad[4][6]='<EFBFBD>';piernad[4][7]='<EFBFBD>';
// Derecha
for (f=0,y=17;f<5;f++,y++) {
gotoxy(64,y);
for (int c=0;c<9;c++) {
if (piernad[f][c]=='<EFBFBD>') {
textcolor(6);
cprintf ("%c",piernad[f][c]);
}
else {
textcolor(7);
cprintf ("<EFBFBD>");
}
}
}
// Izquierda.
for (f=0,y=17;f<5;f++,y++) {
gotoxy(54,y);
for (int c=8;c>=0;c--) {
if (piernad[f][c]=='<EFBFBD>') {
textcolor(6);
cprintf ("%c",piernad[f][c]);
}
else {
textcolor(7);
cprintf ("<EFBFBD>");
}
}
}
// Pintar brazos.
// Derecho
for (f=0,y=12;f<4;f++,y++) {
gotoxy(69,y);
for (int c=0;c<9;c++) {
if (piernad[f][c]=='<EFBFBD>') {
textcolor(6);
cprintf ("%c",piernad[f][c]);
}
else {
textcolor(7);
cprintf ("<EFBFBD>");
}
}
}
// Izquierda.
for (f=0,y=12;f<4;f++,y++) {
gotoxy(49,y);
for (int c=8;c>=0;c--) {
if (piernad[f][c]=='<EFBFBD>') {
textcolor(6);
cprintf ("%c",piernad[f][c]);
}
else {
textcolor(7);
cprintf ("<EFBFBD>");
}
}
}
getch();
}
char ventana (int ancho,int largo,int color_g,int color_borde,char titulo[80],
int color_titulo,int posx,int posy) {
int x,y,cony,conx;
char dib;
dib='<EFBFBD>';
for (cony=0,y=posy;cony<largo;cony++,y++){
for (conx=0,x=posx;conx<ancho;conx++,x++) {
gotoxy(x,y);
if (x==posx || y==posy || y==(posy+(largo-1)) || x==(posx+1)
|| x==(posx+(ancho-2)) || x==(posx+(ancho-1)))
textcolor(color_borde);
else
textcolor(color_g);
cprintf ("%c",dib);
}
}
gotoxy((posx+2),posy);
textcolor(color_titulo);
textbackground(color_borde);
cprintf("%s",titulo);
return(0);
}

56
CPP/DIBUJO.CPP Normal file
View File

@ -0,0 +1,56 @@
// pintar soga
for (int a=1;a<30;a++)
cprintf("<EFBFBD>");
gotoxy(8,21);
for (int b=1;b<26;b++)
cprintf("<EFBFBD>");
for (int f=1,y=20;f<=17;f++,y--) {
gotoxy(19,y);
for (int c=1;c<=4;c++)
cprintf("<EFBFBD>");
}
for (int d=1;d<44;d++)
cprintf("<EFBFBD>");
gotoxy(64,3);
cprintf("<EFBFBD>");
gotoxy(65,3);
cprintf("<EFBFBD>");
gotoxy(64,5);
cprintf("<EFBFBD>");
gotoxy(65,5);
cprintf("<EFBFBD>");
for (int g=1,y2=4;g<=5;g++,y2++) {
gotoxy(62,y2);
textcolor(14);
cprintf("<EFBFBD>");
}
// Inicializaci<63>n de la soga.
soga [0][2]='<EFBFBD>';soga [1][1]='<EFBFBD>';soga [1][3]='<EFBFBD>';soga [2][0]='<EFBFBD>';
soga [2][4]='<EFBFBD>';soga [3][1]='<EFBFBD>';soga [3][3]='<EFBFBD>';soga [4][2]='<EFBFBD>';
for (int jfila=0;jfila<=4;jfila++)
for (int jcolumna=0;jcolumna<=4;jcolumna++) {
gotoxy (jcolumna+60,jfila+8);
if (soga[jfila][jcolumna]=='<EFBFBD>') {
textcolor(14);
cprintf ("%c",soga[jfila][jcolumna]);
}
}
// Inicializaci<63>n de la cabeza.
cabeza [0][3]='<EFBFBD>';cabeza [1][2]='<EFBFBD>';cabeza [2][1]='<EFBFBD>';cabeza [3][0]='<EFBFBD>';
cabeza [4][1]='<EFBFBD>';cabeza [5][2]='<EFBFBD>';cabeza [6][3]='<EFBFBD>';cabeza [5][4]='<EFBFBD>';
cabeza [4][5]='<EFBFBD>';cabeza [3][6]='<EFBFBD>';cabeza [2][5]='<EFBFBD>';cabeza [1][4]='<EFBFBD>';
cabeza [1][3]='<EFBFBD>';cabeza [2][3]='<EFBFBD>';cabeza [3][3]='<EFBFBD>';cabeza [4][3]='<EFBFBD>';
cabeza [5][3]='<EFBFBD>';cabeza [2][2]='<EFBFBD>';cabeza [3][2]='<EFBFBD>';cabeza [4][2]='<EFBFBD>';
cabeza [3][1]='<EFBFBD>';cabeza [2][4]='<EFBFBD>';cabeza [3][4]='<EFBFBD>';cabeza [4][4]='<EFBFBD>';
cabeza [3][5]='<EFBFBD>';cabeza [4][5]='<EFBFBD>';
for (jfila=0;jfila<=6;jfila++)
for (jcolumna=0;jcolumna<=6;jcolumna++) {
gotoxy (jcolumna+60,jfila+7);
if (cabeza[jfila][jcolumna]=='<EFBFBD>') {
textcolor(6);
cprintf ("%c",cabeza[jfila][jcolumna]);
}
}
// fin pintar soga

BIN
CPP/DIC.PRJ Normal file

Binary file not shown.

BIN
CPP/DICCIO.BSD Normal file

Binary file not shown.

BIN
CPP/DICCIO.CFG Normal file

Binary file not shown.

1338
CPP/DICCIO.CPP Normal file

File diff suppressed because it is too large Load Diff

BIN
CPP/DICCIO.EXE Normal file

Binary file not shown.

119
CPP/DXVIDEO.CPP Normal file
View File

@ -0,0 +1,119 @@
// ************************************************************************************************
//
// Direct Video
//
//
// ************************************** (c) Pedro D<>ez L<>pez ************************************
#include <malloc.h>
#include "DXVideo.h"
//
// Inicio
//
BOOL CDXVideo::Inicio(HWND hwnd,int Ancho,int Alto,int BPP)
{
char buf[256];
ddrval = DirectDrawCreate(NULL, &lpDD, NULL);
if(ddrval == DD_OK)
{
ddrval = lpDD->SetCooperativeLevel(hwnd, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
if(ddrval == DD_OK)
{
ddrval = lpDD->SetDisplayMode(Ancho,Alto,BPP);
if(ddrval == DD_OK)
{
ddsd.dwSize = sizeof(ddsd);
ddsd.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT;
ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_FLIP | DDSCAPS_COMPLEX;
ddsd.dwBackBufferCount = 1;
ddrval = lpDD->CreateSurface(&ddsd, &lpDDSView, NULL);
if(ddrval == DD_OK)
{
ddscaps.dwCaps = DDSCAPS_BACKBUFFER;
ddrval = lpDDSView->GetAttachedSurface(&ddscaps, &lpDDSBack);
if(ddrval == DD_OK)
{
hres = Ancho;
vres = Alto;
bpp = BPP;
ElmBuffer = hres*vres;
DimBuffer = hres*vres*(bpp/8);
pBuffer.bpp = malloc (DimBuffer);
if(pBuffer.bpp==NULL)
{
hres = 0;
vres = 0;
bpp = 0;
ElmBuffer = 0;
DimBuffer = 0;
Fin();
return FALSE;
}
return TRUE;
}
}
}
}
}
wsprintf(buf, "Fallo %08lX al iniciliazr DirectDraw\n",ddrval);
MessageBox(hwnd, buf, "ERROR DirectX", MB_OK);
Fin();
return FALSE;
}
//
// Cursor
//
void CDXVideo::Cursor(HCURSOR nCursor)
{
mDDCursorShape = nCursor;
}
//
// Pinta
//
void CDXVideo::Pinta ()
{
// Copia el buffer de trabajo al BackBuffer.
while (TRUE)
{
ddrval=lpDDSBack->Lock(NULL,&ddsd,0,NULL);
if(ddrval == DD_OK) break;
if (ddrval != DDERR_WASSTILLDRAWING) return;
}
lpDXBuffer = (void *)ddsd.lpSurface;
memcpy(lpDXBuffer,pBuffer.bpp,DimBuffer);
lpDDSBack->Unlock(NULL);
// Cambia el buffer.
while (TRUE)
{
ddrval=lpDDSView->Flip(NULL, 0);
if (ddrval == DD_OK) return;
if (ddrval == DDERR_SURFACELOST)
{
ddrval=lpDDSView->Restore();
if (ddrval!=DD_OK) return;
}
if (ddrval!=DDERR_WASSTILLDRAWING) return;
}
}
//
// Fin
//
void CDXVideo::Fin()
{
if (pBuffer.bpp != NULL) free (pBuffer.bpp);
if(lpDD != NULL)
{
if(lpDDSView!=NULL)
{
lpDDSView->Release();
lpDDSView = NULL;
}
lpDD->Release();
lpDD = NULL;
}
}

31
CPP/EJEMPLO1.CPP Normal file
View File

@ -0,0 +1,31 @@
// Programa ejemplo 1
//
// Programadores:
//
// Juan L<>pez Fern<72>ndez
// Mois<69>s Virumbrales Cuenca
// DAI 1<>A
//
// Program ejemplo de tablas.
#include<stdio.h>
#include<conio.h>
int tabla[10];
int con;
void main() {
for (con=0;con<10;con++) {
clrscr();
gotoxy (20,12);
printf ("Introduce n<>meros para llenar la tabla: ");
fflush (stdin);
scanf ("%5d",&tabla[con]);
}
clrscr();
for (con=0;con<10;con++)
printf ("\nEl valor introducido en la posici<63>n %d es: %d",con+1,tabla[con]);
fflush(stdin);
getch();
}

32
CPP/EJEMPLO2.CPP Normal file
View File

@ -0,0 +1,32 @@
// Programa ejemplo 2
//
// Programadores:
//
// Juan L<>pez Fern<72>ndez
// Mois<69>s Virumbrales Cuenca
// DAI 1<>A
//
// Program ejemplo de tablas.
#include<stdio.h>
#include<conio.h>
int tabla[100];
int con,num,conaux;
void main() {
for (con=0,num=10;con<100;con++,num=num+2)
tabla[con]=num;
clrscr();
for (con=99;con>=0;con--,conaux++) {
printf ("\nEl valor introducido en la posici<63>n %d es: %d",con+1,tabla[con]);
if (conaux==24) {
fflush (stdin);
getch();
conaux=0;
}
}
fflush (stdin);
getch();
}

17
CPP/EJEMPLO3.CPP Normal file
View File

@ -0,0 +1,17 @@
// ejemplo3
#include<stdio.h>
#include<conio.h>
int matriz [5][4];
int f,c,cont=1;
void main() {
clrscr();
for(f=0;f<5;f++)
for (c=0;c<4;c++,cont++) {
matriz[f][c]=cont;
printf ("\nMatriz [%d][%d] contiene %d y su direcci<63>n es: %p",f,c,matriz[f][c],&matriz[f][c]);
}
getch();
}

27
CPP/EJEMPLO4.CPP Normal file
View File

@ -0,0 +1,27 @@
// ejemplo4
#include<stdio.h>
#include<conio.h>
int tabla[10][10],num,x,y,sw=1;
void main(){
clrscr();
for (y=0,num=1;y<10;y++){
if (sw==1)
for (x=0;x<10;x++,num++){
tabla[y][x]=num;
printf ("\nValor de la posici<63>n [%d][%d] es: %d",y,x,tabla[y][x]);
sw=0;
}
else
for (x=9;x>=0;x--,num++){
tabla[y][x]=num;
printf ("\nValor de la posici<63>n [%d][%d] es: %d",y,x,tabla[y][x]);
sw=1;
}
fflush(stdin);
getch();
}
fflush(stdin);
getch();
}

35
CPP/ESTADO.CPP Normal file
View File

@ -0,0 +1,35 @@
#include<stdio.h>
#include<conio.h>
#include<dos.h>
void main(){
clrscr();
for (int j=0;j<=40;j++){
textcolor(7);gotoxy(3+j,5);cprintf("<EFBFBD>");
}
textbackground(7);textcolor(15);gotoxy(3,5);cprintf("0%");
for (j=0;j<=40;j++){
textcolor(16);
if (((j*2)+25)<=100){
if (j>6){
gotoxy((j-1)/2,5);textcolor(4);
cprintf("<EFBFBD>");
gotoxy(j/2,5);
}
else
gotoxy(3,5);
textcolor(15);textbackground(4);
cprintf("%d%",(j*2)+25);
}
textcolor(4);
if (j==18)
textbackground(4);
if (j<=40){
gotoxy(3+j,5);cprintf("<EFBFBD>");
}
delay(50);
}
textcolor(7);textbackground(0);
getch();
}

148
CPP/MENU.CPP Normal file
View File

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

149
CPP/MENU.~CP Normal file
View File

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

219
CPP/MIMENU.CPP Normal file
View File

@ -0,0 +1,219 @@
#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include <dos.h>
#define seleccionado color_numero=color_menu=9;settextstyle(7,0,4);
#define no_seleccionado color_numero=3;color_menu=8;settextstyle(8,0,3);
int select_actual=1,num_opciones=5,estoy_en=0;
void menu_principal(int selec_actual); // INICIALIZACION DE FUNCIONES
void sub_menu(int menu);
void modo_grafico();
void leer_tecla(int num_opciones);
void satelite_gsm(int senyal);
// PROGRAMA PRINCIPAL
//-------------------
void main() {
modo_grafico();
menu_principal(select_actual);
leer_tecla(num_opciones);
getch();
closegraph();
}
//FUNCI<43>N QUE INICIA EL MODO GR<47>FICO
//----------------------------------
void modo_grafico(){
int gdriver = DETECT, gmode, errorcode;
initgraph(&gdriver, &gmode, "d:\\tc\\bgi");
errorcode = graphresult();
if (errorcode != grOk){
printf("Error al iniciar el modo gr<67>fico: %s\n", grapherrormsg(errorcode));
printf("Pulse cualquier tecla para finalizar...");
getch();
exit(1);
}
}
// FUNCI<43>N QUE LEE LAS TECLAS PULSADAS
//------------------------------------
void leer_tecla(int num_opciones) {
int tecla,tecla2,sw=1,pintar=0; // VARIABLES
while(sw==1){
tecla=getch();
if(tecla==0){
tecla2=getch();
pintar=0;
switch(tecla2){
case 72:
if (select_actual<=1)
select_actual=num_opciones;
else
select_actual--;
pintar=1;
break;
case 80:
if (select_actual>=num_opciones)
select_actual=1;
else
select_actual++;
pintar=1;
break;
}
}
else
if (tecla==13){
pintar=0;
clearviewport();
satelite_gsm(select_actual);
}
else
if (tecla==27)
sw=0;
if (pintar) {
clearviewport();
// satelite_gsm(select_actual);
menu_principal(select_actual);
}
}
}
// FUNCI<43>N QUE NOS DICE EN QUE LUGAR DEL MENU NOS ENCONTRAMOS
//-----------------------------------------------------------
void satelite_gsm(int senyal) {
if (estoy_en==0){
estoy_en=senyal;
sub_menu(senyal);
}
}
void sub_menu(int menu){
int color_numero=9,color_menu=2,pos_number=0,pos_menu=pos_number+50;
setviewport(170, 100, 600, 300, 0);
switch (menu) {
case 1: // MENU 1: CLIENTES
estoy_en=1;
if (select_actual==1){seleccionado}
else{no_seleccionado}
setcolor(color_numero);outtextxy(0,0,"1.-");
setcolor(color_menu);outtextxy(pos_menu,0,"Altas de Clientes");
if (select_actual==2) {seleccionado}
else{no_seleccionado}
setcolor(color_numero);outtextxy(0,40,"2.-");
setcolor(color_menu);outtextxy(pos_menu,40,"Bajas de Clientes");
if (select_actual==3){seleccionado;}
else{no_seleccionado}
setcolor(color_menu);outtextxy(pos_menu,80,"Modificaciones");
setcolor(color_numero);outtextxy(0,80,"3.-");
if (select_actual==4){seleccionado}
else{no_seleccionado}
setcolor(color_menu);outtextxy(pos_menu,120,"Listar Clientes");
setcolor(color_numero);outtextxy(0,120,"4.-");
if (select_actual==5){seleccionado}
else{no_seleccionado}
setcolor(color_numero);outtextxy(0,160,"5.-");
setcolor(color_menu);outtextxy(pos_menu,160,"Volver");
break;
case 2: // MENU 2 GESTION DE PEDIDOS
if (select_actual==1){seleccionado}
else{no_seleccionado}
setcolor(color_numero);outtextxy(0,0,"1.-");
setcolor(color_menu);outtextxy(pos_menu,0,"Altas de Pel<65>culas");
if (select_actual==2) {seleccionado}
else{no_seleccionado}
setcolor(color_numero);outtextxy(0,40,"2.-");
setcolor(color_menu);outtextxy(pos_menu,40,"Bajas de Pel<65>culas");
if (select_actual==3){seleccionado;}
else{no_seleccionado}
setcolor(color_menu);outtextxy(pos_menu,80,"Modificaciones");
setcolor(color_numero);outtextxy(0,80,"3.-");
if (select_actual==4){seleccionado}
else{no_seleccionado}
setcolor(color_menu);outtextxy(pos_menu,120,"Listar Pel<65>culas");
setcolor(color_numero);outtextxy(0,120,"4.-");
if (select_actual==5){seleccionado}
else{no_seleccionado}
setcolor(color_numero);outtextxy(0,160,"5.-");
setcolor(color_menu);outtextxy(pos_menu,160,"Volver");
break;
case 3: // MENU 3: ALQUILERES
if (select_actual==1){seleccionado}
else{no_seleccionado}
setcolor(color_numero);outtextxy(0,0,"1.-");
setcolor(color_menu);outtextxy(pos_menu,0,"Alquiler");
if (select_actual==2) {seleccionado}
else{no_seleccionado}
setcolor(color_numero);outtextxy(0,40,"2.-");
setcolor(color_menu);outtextxy(pos_menu,40,"Devoluci<EFBFBD>n");
if (select_actual==3){seleccionado;}
else{no_seleccionado}
setcolor(color_menu);outtextxy(pos_menu,80,"Volver");
setcolor(color_numero);outtextxy(0,80,"3.-");
break;
case 4:
if (select_actual==1){seleccionado}
else{no_seleccionado}
setcolor(color_numero);outtextxy(0,0,"1.-");
setcolor(color_menu);outtextxy(pos_menu,0,"Alquiler");
if (select_actual==2) {seleccionado}
else{no_seleccionado}
setcolor(color_numero);outtextxy(0,40,"2.-");
setcolor(color_menu);outtextxy(pos_menu,40,"Devoluci<EFBFBD>n");
if (select_actual==3){seleccionado;}
else{no_seleccionado}
setcolor(color_numero);outtextxy(0,80,"3.-");
setcolor(color_menu);outtextxy(pos_menu,80,"Volver");
break;
}
}
// FUNCI<43>N QUE MUESTRA EL MEN<45> PRINCIPAL
//--------------------------------------
void menu_principal(int select_actual) {
setviewport(170, 100, 600, 300, 0);
int color_numero=9,color_menu=2,pos_number=0,pos_menu=pos_number+50;
if (select_actual==1){seleccionado}
else{no_seleccionado}
setcolor(color_numero);outtextxy(0,0,"1.-");
setcolor(color_menu);outtextxy(pos_menu,0,"Gesti<EFBFBD>n de Clientes");
if (select_actual==2) {seleccionado}
else{no_seleccionado}
setcolor(color_numero);outtextxy(0,40,"2.-");
setcolor(color_menu);outtextxy(pos_menu,40,"Gesti<EFBFBD>n de Pedidos");
if (select_actual==3){seleccionado;}
else{no_seleccionado}
setcolor(color_menu);outtextxy(pos_menu,80,"Alquileres");
setcolor(color_numero);outtextxy(0,80,"3.-");
if (select_actual==4){seleccionado}
else{no_seleccionado}
setcolor(color_menu);outtextxy(pos_menu,120,"Devoluciones");
setcolor(color_numero);outtextxy(0,120,"4.-");
if (select_actual==5){seleccionado}
else{no_seleccionado}
setcolor(color_numero);outtextxy(0,160,"5.-");
setcolor(color_menu);outtextxy(pos_menu,160,"Salir");
}

130
CPP/ORDENA.CPP Normal file
View File

@ -0,0 +1,130 @@
#include <conio.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
FILE *maes, *mov, *movtmp;
struct nodo {
int n;
struct nodo *sig;
};
struct clientes{
char nombre[11], apellidos[21], direccion[21], telefono[11];
int codigo;
};
struct maestro {
int codigo;
char nombre[11], apellidos[21];
char direccion[21], telefono[11];
}regmaes;
struct movi {
char tipo;
int codigo;
char nombre[10], apellidos[20];
char direccion[20], telefono[10];
}regmov;
void INSERTAR (struct nodo **, int);
void ORDENAR (struct nodo **);
void LISTAR_INV (struct nodo *);
void LISTAR (struct nodo *);
int elementos=0;
struct nodo *p=NULL;
void main(void){
if ((mov=fopen("k:\\files\\clientes.mov","r+b"))==NULL)
{
printf("Error. No existe el fichero de movimientos");
exit (1);
}
else {
fread(&regmov,sizeof(regmov),1,mov);
while (!feof(mov))
{
INSERTAR(&p,regmov.codigo);
fread(&regmov,sizeof(regmov),1,mov);
}
fclose (mov);
ORDENAR(&p);
system ("rename k:\\files\\clientes.mov clientes.ord");
if ((movtmp=fopen("k:\\files\\clientes.ord","r+b"))==NULL)
{
printf("Error Muy Gordo. No existe el fichero temporal.");
exit (1);
}
mov=fopen("k:\\files\\clientes.mov","w+b");
struct nodo *q=p;
while (q) {
fread(&regmov,sizeof(regmov),1,movtmp);
if (regmov.codigo == q->n){
fwrite(&regmov,sizeof(regmov),1,mov);
fseek(movtmp,0,0);
q=q->sig;
}
}
//fclose(movtmp);
LISTAR(p);
getch();
free(p);
fcloseall();
unlink ("k:\\files\\clientes.ord");
}
}
//******************************************************************
void INSERTAR (struct nodo **p, int d){
struct nodo *aux;
aux = (struct nodo*) malloc (sizeof(struct nodo));
aux -> n = d;
aux -> sig = (*p);
(*p) = aux;
elementos+=1;
}
void ORDENAR (struct nodo **q){
int j=0,sw=0,n=0;
struct nodo *aux1=NULL, *aux2=NULL,aux;
int i=1;sw=1;
n=elementos-1;
while (i<=n && sw==1){
sw=0;aux2 = *q; aux1 = aux2->sig;
aux.sig=NULL;
aux.n=0;
for (j=1; j< elementos;j++) {
if ((aux2->n)>(aux1->n)){
aux.n=aux2->n;
aux2->n=aux1->n;
aux1->n=aux.n;
sw=1;
}
aux2 = aux1; aux1 = aux1 -> sig;
}
i++;
}
}
void LISTAR_INV (struct nodo *p){
if (p!=NULL) {
LISTAR_INV (p->sig);
printf(" %d ",p->n);
}
}
void LISTAR (struct nodo *p){
if (p!=NULL) {
printf(" %d ",p->n);
LISTAR (p->sig);
}
}

150
CPP/PROG1.CPP Normal file
View File

@ -0,0 +1,150 @@
// Minicalculator<6F> Ver 3.0
// Copyright 1998
//
// Descripci<63>n del programa:
// Este programa pide dos n<>meros, luego muestra un men<65> y dependiendo
// de la opci<63>n elegida los suma, resta, multiplica o divide imprimiendo
// el resultado de la operaci<63>n.
//
// Programadores:
// Juan L<>pez Fern<72>ndez
// Mois<69>s Virumbrales Cuenca
// Grupo 1<>A
//
// Novedades de la Versi<73>n 3.0
// No finaliza el programa hasta que el usuario lo requiere y adem<65>s
// se ha habilitado una nueva opci<63>n para poder introducir valores nuevos.
//
// Novedades de versiones anteriores:
// Versi<73>n 2.2
// Presenta un mensaje de error si la opci<63>n no est<73> en el men<65>
// o si la divisi<73>n es por cero. Adem<65>s cuando la divisi<73>n no es exacta
// se imprime el resto. Tambi<62>n se ha mejorado la interface con el usuario.
// No realiza la resta ni la divisi<73>n si el primer n<>mero es menor que el
// segundo.
// Creado: 3-11-1998
// <20>ltima modificaci<63>n: 12-11-1998
#include <conio.h>
#include <stdio.h>
int a,b,c;
char pausa;
void main ()
{
clrscr();
printf ("\n\t\t\t Minicalculator<6F> Ver 3.0");
printf ("\n\t\t\t <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
printf ("\n\n\n\n\t\t Introduce primer n<>mero: ");
fflush (stdin);
scanf ("%d",&a);
printf ("\n\n\t\t Introduce segundo n<>mero: ");
fflush (stdin);
scanf ("%d",&b);
while (c!=6)
{
clrscr();
printf ("\n\t\t\t Minicalculator<6F> Ver 3.0");
printf ("\n\t\t\t <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
printf ("\n\n\n\t\t\t Men<65> de opciones");
printf ("\n\n\t\t 1.- Sumar los n<>meros introducidos.");
printf ("\n\t\t 2.- Restar los n<>meros introducidos.");
printf ("\n\t\t 3.- Multiplicar los n<>meros introducidos.");
printf ("\n\t\t 4.- Dividir los n<>meros introducidos.");
printf ("\n\t\t 5.- Introducir datos nuevos.");
printf ("\n\t\t 6.- Salir.");
printf ("\n\n\t\t Opci<63>n deseada: ");
fflush(stdin);
scanf ("%d",&c);
if (c==1)
{
printf ("\n\t\t La suma de los n<>meros (%d+%d) es: %d",a,b,a+b);
}
else
{
if (c==2)
{
if (a<b)
{
printf ("\n\t\t <20><> La resta d<> un n<>mero negativo !!");
}
else
{
printf ("\n\t\t La resta de los n<>meros (%d-%d) es: %d",a,b,a-b);
}
}
else
{
if (c==3)
{
printf ("\n\t\t La multiplicaci<63>n de los n<>meros (%d*%d)",a,b);
printf (" es: %d",a*b);
}
else
{
if (c==4)
{
if (b==0)
{
printf ("\n\t\t <20><> Error !!, no se puede dividir por cero.");
}
else
{
if (a<b)
{
printf ("\n\t\t La divisi<73>n no se puede realizar, cambie");
printf (" los valores.");
}
else
{
printf ("\n\t\t La divisi<73>n de los n<>meros (%d/%d)",a,b);
printf (" es: %d",a/b);
if (a%b!=0)
{
printf (" Resto: %d",a%b);
}
}
}
}
else
{
if (c==5)
{
clrscr();
printf ("\n\t\t\t Minicalculator<6F> Ver 3.0");
printf ("\n\t\t\t <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
printf ("\n\n\n\n\t\t Introduce primer n<>mero: ");
fflush (stdin);
scanf ("%d",&a);
printf ("\n\n\t\t Introduce segundo n<>mero: ");
fflush (stdin);
scanf ("%d",&b);
}
else
{
if (c==6)
{
printf ("\n\n\n\n\n\n\n\n\t\t Pulse ENTER para finalizar...");
fflush(stdin);
scanf("%c",&pausa);
}
else
{
printf ("\n\n\t\t\t<EFBFBD><EFBFBD> Opci<63>n incorrecta !!");
}
}
}
}
}
}
if (c!=6 && c!=5)
{
printf ("\n\n\n\n\n\n\n\t\t Pulse ENTER para continuar...");
fflush(stdin);
scanf("%c",&pausa);
}
}
clrscr();
}

101
CPP/PROG10.CPP Normal file
View File

@ -0,0 +1,101 @@
// Prog10
//
// Programadores:
//
// Juan L<>pez Fern<72>ndez
// Mois<69>s Virumbrales Cuenca
// DAI 1<>A
//
// Program que introducido un n<>mero decimal, lo cambia a la base
// introducida.
#include<stdio.h>
#include<conio.h>
int numero,base,cociente,j_resto,numeroaux,resto,baseini;
int tabla[15];
char aux;
// Inicializaci<63>n de funciones.
void imprimir_num(int j_resto);
//int comprobar_base(baseini);
void main () {
clrscr();
gotoxy (20,11);
printf ("Introduce la base del n<>mero: ");
fflush(stdin);
scanf ("%d",&baseini);
gotoxy (20,12);
printf ("Introduce n<>mero: ");
for (j_resto=0;j_resto<15;j_resto++) {
fflush(stdin);
cscanf ("%1c",&aux);
if (aux=='t')
j_resto=15;
tabla[j_resto]=aux;
// else
// if (tabla[j_resto]==97)
}
gotoxy (20,13);
printf ("Introduce base: ");
fflush(stdin);
scanf ("%d",&base);
numeroaux=numero;
j_resto=0;
do {
cociente=numeroaux/base;
resto=numeroaux%base;
tabla[j_resto]=resto;
j_resto++;
numeroaux=cociente;
}
while (base<=cociente);
tabla[j_resto]=cociente;
imprimir_num(j_resto);
fflush(stdin);
getch();
}
// Funci<63>n imprimir n<>mero resultante.
void imprimir_num(int j_resto) {
clrscr();
gotoxy(10,12);
printf ("El n<>mero %d en base %d es: ",numero,base);
for (;j_resto>=0;j_resto--) {
if (tabla[j_resto]<=9)
printf ("%d",tabla[j_resto]);
else
if (tabla[j_resto]==10)
printf ("A");
else
if (tabla[j_resto]==11)
printf ("B");
else
if (tabla[j_resto]==12)
printf ("C");
else
if (tabla[j_resto]==13)
printf ("D");
else
if (tabla[j_resto]==14)
printf ("E");
else
if (tabla[j_resto]==15)
printf ("F");
}
}
// Funci<63>n comprobar base.
//int comprobar_base(int baseini) {
// if (baseini<=9)
// if (tabla[j_resto]>=baseini)
// error=1;
// else
// if (tabla[j_resto]!=065 || tabla[j_resto]!=097 || tabla[j_resto]!=066
//|| tabla[j_resto]!= 067 || tabla[j_resto]!=068 || tabla[j_resto]!=069)
//}

552
CPP/PROG11.CPP Normal file
View File

@ -0,0 +1,552 @@
// Prog9
//
// Programadores:
//
// Juan L<>pez Fern<72>ndez
// Mois<69>s Virumbrales Cuenca
// DAI 1<>A
//
#include<stdio.h>
#include<conio.h>
char ventana (int ancho,int largo,int color_g,int color_borde,char titulo[],
int color_titulo,int posx,int posy);
int intentos(int nivel,int niv,int n);
char psoga();char pcabeza();char pcaraa(); char pcarat();char pcuerpo();
char pextremidades(int lado);char dibujar(int niv,int fallo);
void main() {
int numero[9],n=0,nivel=0,num,tabla[9],color_num[10],niv=0,soga[5][5];
int cabeza[7][7],fallo=0;
for (int aux=0;aux<9;aux++)
tabla[aux]=10;
for (int auxi=0;auxi<=9;auxi++)
color_num[auxi]=0;
textbackground(0);
clrscr();
ventana(80,24,7,1,"Juego del Ahorcado",14,1,1);
textcolor(6);
gotoxy(6,22);
ventana(45,7,7,8,"H",1,20,10);
ventana(45,7,7,1,"Valores iniciales del juego",14,18,9);
textcolor(0);
textbackground(7);
gotoxy(21,11);
cprintf ("Introduce nivel de dificultad(1-7): ");
textcolor(0);
fflush(stdin);
cscanf("%1d",&nivel);
gotoxy(21,13);
cprintf ("Introducir n<>mero a adivinar: ");
do {
textcolor(0);
textbackground(0);
gotoxy(51,13);
fflush(stdin);
cscanf ("%1d",&numero[n]);
n++;
gotoxy (51,13);
textcolor(0);
textbackground(7);
cprintf ("_");
} while (n<nivel);
textbackground(0);
clrscr();
ventana(80,24,7,1,"Juego del Ahorcado",14,1,1);
if (nivel!=6 && nivel!=7)
psoga();
ventana(25,7,7,8,"",8,10,5);
ventana(25,7,7,1,"Estado del juego",14,8,4);
gotoxy(12,6);
textbackground(7);
for (n=0;n<nivel;n++) {
textcolor(0);
cprintf ("_");
textcolor(7);
cprintf (" ");
}
gotoxy (11,8);
for (int number=0;number<=9;number++) {
textcolor(0);
cprintf ("%d",number);
textcolor(7);
cprintf (" ");
}
int sw=1;
ventana(30,7,7,8,"",8,9,15);
ventana(30,7,7,1,"Introducci<EFBFBD>n del n<>mero",14,7,14);
if (nivel==1)
niv=6;
else
if (nivel==2)
niv=5;
else
if (nivel==3)
niv=5;
else
if (nivel==4)
niv=6;
else
if (nivel==5)
niv=6;
else
if (nivel==6)
niv=7;
else
niv=7;
gotoxy(10,18);
textcolor(0);
textbackground(7);
cprintf ("Intentos: ");
textcolor(2);cprintf ("0");textcolor(0);cprintf (" de %d",niv);
for (n=1;n<=niv && sw==1;n++) {
textcolor(0);
textbackground(7);
gotoxy(10,16);
cprintf ("Introduce n<>mero: ");
fflush(stdin);
cscanf ("%1d",&num);
color_num[num]=1;
for (int j=0;j<nivel;j++)
if (numero[j]==num)
tabla[j]=num;
else {
fallo++;
dibujar(niv,fallo);
}
gotoxy(12,6);
for (int i=0;i<nivel;i++) {
textbackground(7);
if (tabla[i]==10) {
textcolor(0);
cprintf ("_");
}
else {
textcolor(5);
cprintf ("%d",tabla[i]);
}
textcolor(7);
cprintf (" ");
}
for (int k=0,con=0;k<nivel;k++)
if (tabla[k]!=10) {
con++;
}
if (con==nivel)
sw=0;
textbackground(7);
gotoxy (11,8);
for (int number=0;number<=9;number++) {
if (color_num[number]==1) {
textcolor(4);
cprintf ("%d",number);
}
else {
textcolor(0);
cprintf ("%d",number);
}
textcolor(7);
cprintf (" ");
}
intentos(nivel,niv,n);
}
if (sw==0) {
ventana(25,5,7,8,"",8,28,11);
ventana(25,5,7,4,"Fin del juego",14,26,10);
gotoxy(31,12);
textcolor(0+BLINK);
textbackground(7);
cprintf ("<EFBFBD><EFBFBD> Ha ganado !!");
}
else {
ventana(30,7,7,8,"",8,26,10);
ventana(30,7,7,4,"Fin del juego",14,24,9);
gotoxy(28,11);
textcolor(0);
textbackground(7);
cprintf ("Ha perdido");
gotoxy(28,13);
cprintf ("El n<>mero era: ");
for (int b=0;b<nivel;b++)
cprintf ("%d",numero[b]);
}
getch();
}
// ******************FIN DE PROGRAMA PRINCIPAL************************
char ventana (int ancho,int largo,int color_g,int color_borde,char titulo[80],
int color_titulo,int posx,int posy) {
int x,y,cony,conx;
char dib;
dib='<EFBFBD>';
for (cony=0,y=posy;cony<largo;cony++,y++){
for (conx=0,x=posx;conx<ancho;conx++,x++) {
gotoxy(x,y);
if (x==posx || y==posy || y==(posy+(largo-1)) || x==(posx+1)
|| x==(posx+(ancho-2)) || x==(posx+(ancho-1)))
textcolor(color_borde);
else
textcolor(color_g);
cprintf ("%c",dib);
}
}
gotoxy((posx+2),posy);
textcolor(color_titulo);
textbackground(color_borde);
cprintf("%s",titulo);
return(0);
}
// Funci<63>n color de intentos.
int intentos(int nivel,int niv,int n) {
gotoxy(10,18);
textbackground(7);
if (nivel==1 || nivel==4 || nivel==5) {
if (n<3) {
textcolor(0);
cprintf ("Intentos: ");
textcolor(2);
cprintf ("%d",n);
textcolor(0);
cprintf (" de %d",niv);
}
else
if (n<5) {
textcolor(0);
cprintf ("Intentos: ");
textcolor(14);
cprintf ("%d",n);
textcolor(0);
cprintf (" de %d",niv);
}
else {
textcolor(0);
cprintf ("Intentos: ");
textcolor(4+BLINK);
cprintf ("%d",n);
textcolor(0);
cprintf (" de %d",niv);
}
}
if (nivel==2 || nivel==3) {
if (n<3) {
textcolor(0);
cprintf ("Intentos: ");
textcolor(2);
cprintf ("%d",n);
textcolor(0);
cprintf (" de %d",niv);
}
else
if (n<4) {
textcolor(0);
cprintf ("Intentos: ");
textcolor(14);
cprintf ("%d",n);
textcolor(0);
cprintf (" de %d",niv);
}
else {
textcolor(0);
cprintf ("Intentos: ");
textcolor(4+BLINK);
cprintf ("%d",n);
textcolor(0);
cprintf (" de %d",niv);
}
}
if (nivel==6 || nivel==7) {
if (n<4) {
textcolor(0);
cprintf ("Intentos: ");
textcolor(2);
cprintf ("%d",n);
textcolor(0);
cprintf (" de %d",niv);
}
else
if (n<6) {
textcolor(0);
cprintf ("Intentos: ");
textcolor(14);
cprintf ("%d",n);
textcolor(0);
cprintf (" de %d",niv);
}
else {
textcolor(0);
cprintf ("Intentos: ");
textcolor(4+BLINK);
cprintf ("%d",n);
textcolor(0);
cprintf (" de %d",niv);
}
}
return(0);
}
// Dibujar.
char dibujar (int niv,int fallo) {
if (niv==5)
switch (fallo) {
case 1:
pcabeza();
pcaraa();
break;
case 2:
pcuerpo();
break;
case 3:
pextremidades(3);
pextremidades(4);
break;
case 4:
pextremidades(1);
break;
case 5:
pextremidades(2);
pcarat();
break;
}
else
if (niv==6)
switch (fallo) {
case 1:
pcabeza();
pcaraa();
break;
case 2:
pcuerpo();
break;
case 3:
pextremidades(3);
break;
case 4:
pextremidades(4);
break;
case 5:
pextremidades(1);
break;
case 6:
pextremidades(2);
pcarat();
break;
}
else
if (niv==7)
switch (fallo) {
case 1:
psoga();
break;
case 2:
pcabeza();
pcaraa();
break;
case 3:
pcuerpo();
break;
case 4:
pextremidades(3);
break;
case 5:
pextremidades(4);
break;
case 6:
pextremidades(1);
break;
case 7:
pextremidades(2);
pcarat();
break;
}
return (0);
}
// Pintar soga.
char psoga(){
int soga[12][7];
soga[0][3]='<EFBFBD>';soga[1][3]='<EFBFBD>';soga[2][3]='<EFBFBD>';soga[3][3]='<EFBFBD>';soga[4][3]='<EFBFBD>';
soga[5][2]='<EFBFBD>';soga[5][4]='<EFBFBD>';soga[6][1]='<EFBFBD>';soga[6][5]='<EFBFBD>';soga[7][0]='<EFBFBD>';
soga[7][6]='<EFBFBD>';soga[8][0]='<EFBFBD>';soga[8][6]='<EFBFBD>';soga[9][0]='<EFBFBD>';soga[9][6]='<EFBFBD>';
soga[10][1]='<EFBFBD>';soga[10][5]='<EFBFBD>';soga[11][2]='<EFBFBD>';soga[11][3]='<EFBFBD>';
soga[11][4]='<EFBFBD>';
for (int f=2,y=2;f<12;f++,y++) {
gotoxy(60,y);
for (int c=0;c<7;c++) {
if (soga[f][c]=='<EFBFBD>') {
textcolor(14);
cprintf ("%c",soga[f][c]);
}
else {
textcolor(7);
cprintf ("<EFBFBD>");
}
}
}
return(0);
}
// pintar cabeza
char pcabeza() {
int cabeza[5][7],pelo[2][7];
cabeza[0][1]='<EFBFBD>';cabeza[0][2]='<EFBFBD>';cabeza[0][3]='<EFBFBD>';cabeza[0][4]='<EFBFBD>';
cabeza[0][5]='<EFBFBD>';cabeza[1][0]='<EFBFBD>';cabeza[1][1]='<EFBFBD>';cabeza[1][2]='<EFBFBD>';
cabeza[1][3]='<EFBFBD>';cabeza[1][4]='<EFBFBD>';cabeza[1][5]='<EFBFBD>';cabeza[1][6]='<EFBFBD>';
cabeza[2][0]='<EFBFBD>';cabeza[2][1]='<EFBFBD>';cabeza[2][2]='<EFBFBD>';cabeza[2][3]='<EFBFBD>';
cabeza[2][4]='<EFBFBD>';cabeza[2][5]='<EFBFBD>';cabeza[2][6]='<EFBFBD>';
cabeza[3][1]='<EFBFBD>';cabeza[3][2]='<EFBFBD>';cabeza[3][3]='<EFBFBD>';cabeza[3][4]='<EFBFBD>';
cabeza[3][5]='<EFBFBD>';cabeza[4][2]='<EFBFBD>';cabeza[4][3]='<EFBFBD>';cabeza[4][4]='<EFBFBD>';
for (int f=0,y=6;f<5;f++,y++) {
gotoxy(60,y);
for (int c=0;c<7;c++) {
if (cabeza[f][c]=='<EFBFBD>') {
textcolor(6);
cprintf ("%c",cabeza[f][c]);
}
else {
textcolor(14);
cprintf ("<EFBFBD>");
}
}
}
// Pintar pelo
pelo[0][0]='<EFBFBD>';pelo[0][1]='<EFBFBD>';pelo[0][2]='<EFBFBD>';pelo[0][3]='<EFBFBD>';
pelo[0][4]='<EFBFBD>';pelo[0][5]='<EFBFBD>';pelo[0][6]='<EFBFBD>';pelo[1][0]='<EFBFBD>';
pelo[1][6]='<EFBFBD>';
for (f=0,y=5;f<2;f++,y++) {
gotoxy(60,y);
for (int c=0;c<7;c++) {
if (pelo[f][c]=='<EFBFBD>') {
textcolor(0);
cprintf ("%c",pelo[f][c]);
}
else {
textcolor(6);
cprintf ("<EFBFBD>");
}
}
}
return (0);
}
// Pintar cara alegre.
char pcaraa() {
// Pintar ojos
textbackground(6);textcolor(0);
gotoxy (62,7);cprintf ("O");
gotoxy (64,7);cprintf ("O");
// Pintar nariz.
gotoxy(63,8);cprintf("U");
// Pintar boca.
gotoxy(62,9);cprintf("<EFBFBD>");
gotoxy(64,9);cprintf("<EFBFBD>");
gotoxy(63,9);cprintf("-");
return(0);
}
// Pintar cara triste.
char pcarat() {
// Pintar ojos
textbackground(6);textcolor(0);
gotoxy (62,7);cprintf ("*");
gotoxy (64,7);cprintf ("*");
// Pintar nariz.
gotoxy(63,8);cprintf("U");
// Pintar boca.
gotoxy(62,9);cprintf("+");
gotoxy(64,9);cprintf("+");
gotoxy(63,9);cprintf("+");
return(0);
}
// Pintar cuerpo.
char pcuerpo() {
ventana(11,5,9,9,"",9,58,12);
return(0);
}
// Pinta extremidades
char pextremidades(int lado) {
int piernad[5][9];
piernad[0][0]='<EFBFBD>';piernad[0][1]='<EFBFBD>';piernad[0][2]='<EFBFBD>';piernad[0][3]='<EFBFBD>';
piernad[1][1]='<EFBFBD>';piernad[1][2]='<EFBFBD>';piernad[1][3]='<EFBFBD>';piernad[1][4]='<EFBFBD>';
piernad[2][2]='<EFBFBD>';piernad[2][3]='<EFBFBD>';piernad[2][4]='<EFBFBD>';piernad[2][5]='<EFBFBD>';
piernad[3][3]='<EFBFBD>';piernad[3][4]='<EFBFBD>';piernad[3][5]='<EFBFBD>';piernad[3][6]='<EFBFBD>';
piernad[4][4]='<EFBFBD>';piernad[4][5]='<EFBFBD>';piernad[4][6]='<EFBFBD>';piernad[4][7]='<EFBFBD>';
if (lado==2) {
// Pierna Derecha
for (int f=0,y=17;f<5;f++,y++) {
gotoxy(64,y);
for (int c=0;c<9;c++) {
if (piernad[f][c]=='<EFBFBD>') {
textcolor(9);
cprintf ("%c",piernad[f][c]);
}
else {
textcolor(7);
cprintf ("<EFBFBD>");
}
}
}
}
if (lado==1) {
// Pierna Izquierda.
for (int f=0,y=17;f<5;f++,y++) {
gotoxy(54,y);
for (int c=8;c>=0;c--) {
if (piernad[f][c]=='<EFBFBD>') {
textcolor(9);
cprintf ("%c",piernad[f][c]);
}
else {
textcolor(7);
cprintf ("<EFBFBD>");
}
}
}
}
if (lado==4) {
// Brazo Derecho
for (int f=0,y=12;f<4;f++,y++) {
gotoxy(69,y);
for (int c=0;c<9;c++) {
if (piernad[f][c]=='<EFBFBD>') {
textcolor(9);
cprintf ("%c",piernad[f][c]);
}
else {
textcolor(7);
cprintf ("<EFBFBD>");
}
}
}
}
if (lado==3) {
// Izquierda.
for (int f=0,y=12;f<4;f++,y++) {
gotoxy(49,y);
for (int c=8;c>=0;c--) {
if (piernad[f][c]=='<EFBFBD>') {
textcolor(9);
cprintf ("%c",piernad[f][c]);
}
else {
textcolor(7);
cprintf ("<EFBFBD>");
}
}
}
}
return(0);
}

422
CPP/PROG13.CPP Normal file
View File

@ -0,0 +1,422 @@
#include<stdio.h>
#include<conio.h>
char ventana (int ancho,int largo,int color_g,int color_borde,char titulo[],
int color_titulo,int posx,int posy);
char ventanaarchivo(int op);char ventanaoperaciones();
char ventanaayuda(int op);char ventanageneral(int op);
char ventanatipomatriz();
char pagina(int numero);char instrucciones(char opt,int numero_pag);
void main(){
int salir=0;
do {
char tecla;
int numero=0,col,tipomatriz;
ventanageneral(0);
do {
textcolor(1);textbackground(1);gotoxy(78,24);
fflush(stdin);cscanf("%1c",&tecla);numero=tecla;
} while (numero!=97 && numero!=121 && numero!=27);
if (numero==97) {
ventanaarchivo(0);
do {
textcolor(1);textbackground(1);gotoxy(78,24);
fflush(stdin);cscanf("%1c",&tecla);numero=tecla;
} while (numero!=115 && numero!=109 && numero!=108 && numero!=27);
if (numero==108) {
ventanageneral(0);ventana(35,5,8,8,"",8,24,11);
ventana(35,5,7,4,"Salir",14,22,10);
gotoxy(26,12);textbackground(7);textcolor(0);
cprintf("<EFBFBD>Desea salir del programa?");
do {
textcolor(1);textbackground(1);gotoxy(78,24);
fflush(stdin);cscanf("%1c",&tecla);numero=tecla;
} while (numero!=115 && numero!=110 && numero!=27);
if (numero==115)
salir=1;
}
else {
if (numero==109) {
tipomatriz=ventanatipomatriz();
ventanageneral(0);
switch(tipomatriz){
case 49:
break;
case 50:
int matriz[3][3];
ventana(20,7,8,8,"",8,9,6);
ventana(20,7,7,1,"Matriz",14,7,5);
gotoxy(11,6);textcolor(0);textbackground(7);
cprintf("<EFBFBD>");gotoxy(11,7);cprintf("<EFBFBD>");gotoxy(11,8);cprintf("<EFBFBD>");
gotoxy(11,9);cprintf("<EFBFBD>");gotoxy(11,10);cprintf("<EFBFBD>");
gotoxy(22,6);cprintf("<EFBFBD>");gotoxy(22,7);cprintf("<EFBFBD>");
gotoxy(22,8);cprintf("<EFBFBD>");gotoxy(22,9);cprintf("<EFBFBD>");
gotoxy(22,10);cprintf("<EFBFBD>");
for (int f=1;f<=3;f++)
for(int c=2;c<=9;c=c+3){
gotoxy(12+c,6+f);cprintf("*");
}
ventana(35,5,8,8,"",8,37,7);
ventana(35,5,7,1,"Introducci<EFBFBD>n de la matriz",14,35,6);
gotoxy(39,8);textcolor(0);textbackground(7);
cprintf("Introduce n<>mero: ");
int num,col=0;
for (f=1;f<=3 && numero!=27;f++){
for (col=(-1),c=2;c<=9 && numero!=27;col++){
if (c>2){
matriz[f-1][col]=num;
textcolor(0);gotoxy(12+(c-3),6+f);
cprintf("%d",matriz[f-1][col]);
textcolor(0+BLINK);gotoxy(12+c,6+f);cprintf("*");
c=c+3;
}
else {
textcolor(0+BLINK);gotoxy(12+c,6+f);cprintf("*");
c=c+3;
}
num=10;
do {
do {
if (numero==0) {
gotoxy(57,8);textcolor(7);cprintf("<EFBFBD>");
}
textcolor(0);gotoxy(57,8);
fflush(stdin);cscanf("%1c",&tecla);numero=tecla;
if (numero==13 && num==10){
num=0;
ventana(35,7,8,8,"",8,27,14);
ventana(35,7,7,4,"Error 002",14+BLINK,25,13);
textcolor(0);textbackground(7);gotoxy(29,15);
cprintf("Al no haber introducido nin-");
gotoxy(29,16);cprintf("g<EFBFBD>n valor, se introduce por");
gotoxy(29,17);cprintf("defecto el 0.");
fflush(stdin);getch();
ventana(35,7,15,15,"",15,27,14);
ventana(35,7,15,15,"",15,25,13);
}
if (numero!=27 && numero!=13 && numero<48 || numero>57) {
ventana(35,6,8,8,"",8,27,14);
ventana(35,6,7,4,"Error 001",14+BLINK,25,13);
textcolor(0);textbackground(7);gotoxy(29,15);
cprintf("No se puede introducir un");
gotoxy(29,16);cprintf("car<EFBFBD>cter,solo n<>meros.");
fflush(stdin);getch();
ventana(35,6,15,15,"",15,27,14);
ventana(35,6,15,15,"",15,25,13);
numero=0;
}
}while(numero!=27 && numero!=13 && numero<48 || numero>57);
if (numero>=48 && numero<=57){
switch(numero) {
case 48:
num=0;break;
case 49:
num=1;break;
case 50:
num=2;break;
case 51:
num=3;break;
case 52:
num=4;break;
case 53:
num=5;break;
case 54:
num=6;break;
case 55:
num=7;break;
case 56:
num=8;break;
case 57:
num=9;break;
}
}
}while(numero!=13 && numero!=27);
gotoxy(57,8);textcolor(7);cprintf("<EFBFBD>");
}
matriz[f-1][col]=num;
textcolor(0);gotoxy(12+(c-3),6+f);
cprintf("%d",matriz[f-1][col]);
}
ventanageneral(1);
ventana(20,7,8,8,"",8,9,6);
ventana(20,7,7,1,"Matriz",14,7,5);
gotoxy(11,6);textcolor(0);textbackground(7);
cprintf("<EFBFBD>");gotoxy(11,7);cprintf("<EFBFBD>");gotoxy(11,8);cprintf("<EFBFBD>");
gotoxy(11,9);cprintf("<EFBFBD>");gotoxy(11,10);cprintf("<EFBFBD>");
gotoxy(22,6);cprintf("<EFBFBD>");gotoxy(22,7);cprintf("<EFBFBD>");
gotoxy(22,8);cprintf("<EFBFBD>");gotoxy(22,9);cprintf("<EFBFBD>");
gotoxy(22,10);cprintf("<EFBFBD>");
for (f=1;f<=3;f++){
for (col=0,c=5;c<=9;c=c+3,col++){
textcolor(0);gotoxy(12+(c-3),6+f);
cprintf("%d",matriz[f-1][col]);
}
textcolor(0);gotoxy(12+(c-3),6+f);
cprintf("%d",matriz[f-1][col]);
}
break;
}
do {
textcolor(1);textbackground(1);gotoxy(78,24);
fflush(stdin);cscanf("%1c",&tecla);numero=tecla;
} while (numero!=97 && numero!=121 && numero!=111 && numero!=27);
switch(numero){
case 111:
ventanaoperaciones();
getch();
}
}
}
}
else {
if (numero==121) {
ventanaayuda(0);
do {
textcolor(1);textbackground(1);gotoxy(78,24);
fflush(stdin);cscanf("%1c",&tecla);numero=tecla;
} while (numero!=121 && numero!=97 && numero!=27);
if (numero==97) {
ventanageneral(0);
ventana(35,9,8,8,"",8,24,9);
ventana(35,9,7,1,"Acerca de...",14,22,8);
gotoxy(29,10);textbackground(7);textcolor(4+BLINK);
cprintf("MATRIMATIC<EFBFBD> ver 1.0");
gotoxy(25,12);textcolor(0);cprintf("Programado por:");
gotoxy(27,13);textcolor(15);cprintf("Mois<EFBFBD>s Virumbrales Cuenca");
gotoxy(40,15);textcolor(0);cprintf("Copyright 1999");
fflush(stdin);getch();
}
else {
if (numero==121) {
ventanageneral(0);
int numpag=1;char opcion='a';
numpag=instrucciones(opcion,numpag);
for (;numpag!=10;) {
textcolor(1);textbackground(1);gotoxy(78,24);
fflush(stdin);cscanf("%1c",&opcion);
numpag=instrucciones(opcion,numpag);
}
}
}
}
else {
ventana(35,5,8,8,"",8,24,11);
ventana(35,5,7,4,"Salir",14,22,10);
gotoxy(26,12);textbackground(7);textcolor(0);
cprintf("<EFBFBD>Desea salir del programa?");
do {
textcolor(1);textbackground(1);gotoxy(78,24);
fflush(stdin);cscanf("%1c",&tecla);numero=tecla;
} while (numero!=115 && numero!=110 && numero!=27);
if (numero==115)
salir=1;
}
}
textcolor(0);
} while(salir==0);
}
// Funci<63>n ventana.
char ventana (int ancho,int largo,int color_g,int color_borde,char titulo[80],
int color_titulo,int posx,int posy) {
int x,y,cony,conx;
char dib;
dib='<EFBFBD>';
for (cony=0,y=posy;cony<largo;cony++,y++){
for (conx=0,x=posx;conx<ancho;conx++,x++) {
gotoxy(x,y);
if (x==posx || y==posy || y==(posy+(largo-1)) || x==(posx+1)
|| x==(posx+(ancho-2)) || x==(posx+(ancho-1)))
textcolor(color_borde);
else
textcolor(color_g);
cprintf ("%c",dib);
}
}
gotoxy((posx+2),posy);
textcolor(color_titulo);
textbackground(color_borde);
cprintf("%s",titulo);
return(0);
}
//Funci<63>n ventanaarchivo
char ventanaarchivo(int op) {
textbackground(0);
clrscr();
ventana(80,24,15,1,"Matrimatic<EFBFBD>",14,1,1);ventana(76,1,7,7,"",7,3,2);
gotoxy(5,2);textbackground(0);
textcolor(15);cprintf("Archivo");
gotoxy(14,2);textbackground(7);
if (op==1){
textcolor(15);cprintf("O");textcolor(0);cprintf("peraciones");
}
else{
textcolor(8);cprintf("Operaciones");
}
gotoxy(27,2);
textcolor(0);cprintf("A");textcolor(15);cprintf("y");
textcolor(0);cprintf("uda");
ventana(16,5,7,7,"",7,5,3);
textcolor(0);textbackground(7);
gotoxy(7,4);cprintf("Nueva ");textcolor(15);cprintf("M");
textcolor(0);cprintf("atriz");
gotoxy(7,5);cprintf("Nuevo ");textcolor(15);cprintf("S");
textcolor(0);cprintf("istema");
gotoxy(5,6);cprintf("----------------");
gotoxy(7,7);textcolor(0);cprintf("Sa");textcolor(15);cprintf("l");
textcolor(0);cprintf("ir ");textcolor(15);cprintf("Esc");
return(0);
}
//Funci<63>n ventanaoperaciones
char ventanaoperaciones(){
textbackground(0);
ventana(20,5,7,7,"",7,14,3);
gotoxy(15,4);textcolor(0);cprintf("Inversa");
gotoxy(15,5);cprintf("Adjunta");
gotoxy(15,6);cprintf("Traspuesta");
return(0);
}
//Funci<63>n ventanaayuda
char ventanaayuda(int op){
textbackground(0);clrscr();
ventana(80,24,15,1,"Matrimatic<EFBFBD>",14,1,1);ventana(76,1,7,7,"",7,3,2);
gotoxy(5,2);textbackground(7);
textcolor(15);cprintf("A");textcolor(0);cprintf("rchivo");
gotoxy(14,2);
if (op==1){
textcolor(15);cprintf("O");textcolor(0);cprintf("peraciones");
}
else{
textcolor(8);cprintf("Operaciones");
}
gotoxy(27,2);textbackground(0);
textcolor(15);cprintf("Ayuda");
ventana(15,4,7,7,"",7,27,3);
gotoxy(28,4);textcolor(0);cprintf("A");textcolor(15);cprintf("y");
textcolor(0);cprintf("uda");
gotoxy(27,5);cprintf("---------------");
gotoxy(28,6);textcolor(15);cprintf("A");textcolor(0);cprintf("cerca de...");
return(0);
}
//Funci<63>n ventanageneral
char ventanageneral(int op){
textbackground(0);
clrscr();
ventana(80,24,15,1,"Matrimatic<EFBFBD>",14,1,1);
ventana(76,1,7,7,"",7,3,2);
gotoxy(5,2);
textbackground(7);
textcolor(15);cprintf("A");textcolor(0);cprintf("rchivo");
gotoxy(14,2);
if(op==1) {
textcolor(15);cprintf("O");textcolor(0);cprintf("peraciones");
}
else{
textcolor(8);cprintf("Operaciones");
}
gotoxy(27,2);
textcolor(0);cprintf("A");textcolor(15);cprintf("y");
textcolor(0);cprintf("uda");
return(0);
}
// Funci<63>n ventanatipomatriz.
char ventanatipomatriz(){
int col=7,numero=0;char tecla;
ventanageneral(0);
ventana(35,12,8,8,"",8,22,8);
ventana(35,12,7,1,"Nueva Matriz",14,20,7);
int num;
do {
if (numero==49)
col=4;
else
col=7;
textbackground(col);gotoxy(23,9);textcolor(15);cprintf(" 1");
textcolor(0);cprintf(".- Matriz de 2*2 ");
if (numero==50)
col=4;
else
col=7;
textbackground(col);gotoxy(23,10);textcolor(15);cprintf(" 2");
textcolor(0);cprintf(".- Matriz de 3*3 ");
if (numero==51)
col=4;
else
col=7;
textbackground(col);gotoxy(23,11);textcolor(15);cprintf(" 3");
textcolor(0);cprintf(".- Matriz de 4*4 ");
if (numero==52)
col=4;
else
col=7;
textbackground(col);gotoxy(23,12);textcolor(15);cprintf(" 4");
textcolor(0);cprintf(".- Matriz de 5*5 ");
if (numero==53)
col=4;
else
col=7;
textbackground(col);gotoxy(23,13);textcolor(15);cprintf(" 5");
textcolor(0);cprintf(".- Matriz de 6*6 ");
textbackground(7);gotoxy(24,15);cprintf("Elija n<>mero y pulse ENTER ");
gotoxy(24,16);cprintf("para continuar.");
do {
textcolor(1);textbackground(1);gotoxy(78,24);
fflush(stdin);cscanf("%1c",&tecla);numero=tecla;
} while (numero!=49 && numero!=50 && numero!=51 && numero!=52 &&
numero!=53 && numero!=13 && numero!=27);
if (numero!=13 && numero!=27)
num=numero;
} while (numero!=13 && numero!=27);
return(num);
}
// Funci<63>n instrucciones.
char instrucciones(char opt,int numero_pag) {
if (opt=='s' && numero_pag!=4) {
numero_pag++;pagina(numero_pag);
}
else
if (opt=='s') pagina(numero_pag);
if (opt=='a' && numero_pag!=1) {
numero_pag--;pagina(numero_pag);
}
else
if (opt=='a') pagina(numero_pag);
if (opt=='q')
numero_pag=10;
return (numero_pag);
}
//Funci<63>n paginas
char pagina(int numero) {
switch (numero) {
case 1:
ventana(60,18,7,8,"",8,12,5);
ventana(60,18,7,1,"Ayuda interactiva",14,10,4);
textbackground(7);textcolor(0);gotoxy (53,5);cprintf ("P<EFBFBD>gina 1 de 4.");
gotoxy(15,6);textcolor(15);cprintf("1");textcolor(0);
cprintf(".- <20>C<EFBFBD>mo utilizar la ayuda?");
gotoxy(15,7);textcolor(15);cprintf("2");textcolor(0);
cprintf(".- Introducci<63>n de una nueva matriz.");
gotoxy(15,8);textcolor(15);cprintf("3");textcolor(0);
cprintf(".- Introducci<63>n de un nuevo sistema de ecuaciones.");
gotoxy(15,9);textcolor(15);cprintf("4");textcolor(0);
cprintf(".- Operaciones con matrices.");
gotoxy(13,20);textcolor(8);cprintf ("A:p<>g. anterior ");
textcolor(15);cprintf (" S");textcolor(0);cprintf(":p<>g. siguiente ");
textcolor(15);cprintf (" Q");textcolor(0);cprintf(":salir de la ayuda");
break;
}
return(0);
}

90
CPP/PROG2.CPP Normal file
View File

@ -0,0 +1,90 @@
// Prog2
// Programadores:
// Juan L<>pez Fern<72>ndez
// Mois<69>s Virumbrales Cuenca
// DAI 1<>A
// Imprimir, contar y sumar los elementos m<>ltiplos de 7 comprendidos
// entre 1 y un n<>mero introducido por teclado previamente.
#include <stdio.h>
#include <conio.h>
int con,sum,j,num,pant,conpag;
char pausa;
void main()
{
clrscr();
fflush (stdin);
gotoxy (20,12);
printf("Introduce un N<>mero: ");
scanf ("%d", &num);
while (num < 1)
{
clrscr();
fflush (stdin);
gotoxy (12,12);
printf("Introduce un N<>mero correcto (mayor o igual que 1): ");
scanf ("%d", &num);
}
con=0;
sum=0;
j=7;
pant=0;
conpag=0;
clrscr();
if (num>=j)
{
printf ("\t\t Lista de los m<>ltiplos de siete entre 1 y %d.\n",num);
while (j<=num)
{
pant++;
if (pant<=219)
{
printf ("\t%d",j);
con++;
sum=sum+j;
j=j+7;
}
else
{
conpag++;
pant=0;
printf ("\n P<>gina: %d.\t\t\t\t\tPulsa ENTER para continuar...",conpag);
fflush (stdin);
scanf ("%c",&pausa);
clrscr();
printf ("\t\t Lista de los m<>ltiplos de siete entre 1 y %d.\n",num);
}
}
conpag++;
gotoxy (1,25);
printf (" P<>gina: %d.\t\t\t\t\tPulsa ENTER para continuar...",conpag);
fflush(stdin);
scanf("%c",&pausa);
clrscr();
gotoxy (20,11);
if (con==1)
{
printf("Hay %d m<>ltiplo de siete.",con);
}
else
{
printf("Hay %d m<>ltiplos de siete.",con);
}
gotoxy (20,12);
printf("Su suma es: %d",sum);
fflush(stdin);
scanf("%c",&pausa);
}
else
{
clrscr();
gotoxy (20,11);
printf("Hay %d m<>ltiplos de siete.",con);
gotoxy (20,12);
printf("Su suma es: %d",sum);
fflush(stdin);
scanf("%c",&pausa);
}
clrscr();
}

105
CPP/PROG3.CPP Normal file
View File

@ -0,0 +1,105 @@
// Prog3
//
// Programadores:
// Juan L<>pez Fern<72>ndez
// Mois<69>s Virumbrales Cuenca
// DAI 1<>A
//
// Pedir n<>meros hasta que se introduzca un cero, y de todos los valores
// introducidos, calcular la media de los m<>ltiplos de 5 menores que 500,
// sumar los impares comprendidos entre -10 y 10, contar los m<>ltiplos de
// 13 y calcular la media de todos los n<>meros introducidos.
#include <stdio.h>
#include <conio.h>
int con,sum,con5,sum5,sumimpar,con13,num;
char pausa;
void main()
{
clrscr();
gotoxy (20,13);
printf (" (Introduzca 0 para finalizar)");
gotoxy (20,12);
printf (" Introduce un n<>mero: ");
fflush(stdin);
scanf ("%d",&num);
while (num!=0)
{
if (num %5==0 && num <500)
{
con5++;
sum5=sum5+num;
}
if (num>-10 && num<10 && num %2!=0)
{
sumimpar=sumimpar+num;
}
if (num %13==0)
{
con13++;
}
con++;
sum=sum +num;
clrscr();
gotoxy (20,13);
printf (" (Introduzca 0 para finalizar)");
gotoxy (20,12);
printf (" Introduce un n<>mero: ");
fflush(stdin);
scanf ("%d",&num);
}
clrscr();
if (con==0)
{
gotoxy (20,12);
printf (" No se ha introducido ning<6E>n n<>mero.");
}
else
{
if (con5==0)
{
gotoxy (13,10);
printf (" No hay m<>ltiplos de 5.");
}
else
{
gotoxy (13,10);
printf (" La media de los m<>ltiplos de 5 menores que 500 es: ");
printf ("%d.",sum5/con5);
}
if (sumimpar==0)
{
gotoxy (13,11);
printf (" No hay impares comprendidos entre -10 y 10.");
}
else
{
gotoxy (13,11);
printf (" La suma de los impares entre -10 y 10 es: %d.",sumimpar);
}
if (con13==0)
{
gotoxy (13,12);
printf (" No hay m<>ltiplos de 13.");
}
else
{
gotoxy (13,12);
printf (" Hay %d m<>ltiplo(s) de 13.",con13);
}
gotoxy (13,13);
printf (" La media de todos los n<>meros introducidos es: %d.",sum/con);
}
fflush (stdin);
scanf ("%c",&pausa);
}

112
CPP/PROG4.CPP Normal file
View File

@ -0,0 +1,112 @@
// Prog4
//
// Programadores:
// Juan L<>pez Fern<72>ndez
// Mois<69>s Virumbrales Cuenca
// DAI 1<>A
//
// Pedir n<>meros hasta que se introduzca un cero. Imprimir el mayor de todos
// los pares y la posici<63>n en que se introdujo, el menor de los m<>ltiplos
// de 6 y la posici<63>n en que se introdujo, el mayor de todos los valores
// y la posici<63>n en que se introdujo.
#include <stdio.h>
#include <conio.h>
int mayorpar,pospar,menor6,posmenor6,mayor,posmayor,con,num;
char pausa;
void main()
{
mayorpar=-32768;pospar=0;menor6=32767;posmenor6=0;mayor=-32768;
posmayor=0;con=0;num=0;
clrscr();
gotoxy (20,13);
printf (" (Introduzca 0 para finalizar)");
gotoxy (20,12);
printf (" Introduce un n<>mero: ");
fflush(stdin);
scanf ("%d",&num);
while (num!=0)
{
con++;
if (num %2==0 && num>mayorpar)
{
mayorpar=num;
pospar=con;
}
if (num %6==0 && num<menor6)
{
menor6=num;
posmenor6=con;
}
if (num>mayor)
{
mayor=num;
posmayor=con;
}
clrscr();
gotoxy (20,13);
printf (" (Introduzca 0 para finalizar)");
gotoxy (20,12);
printf (" Introduce un n<>mero: ");
fflush(stdin);
scanf ("%d",&num);
}
clrscr();
if (con==0)
{
gotoxy (20,12);
printf (" No se ha introducido ning<6E>n n<>mero.");
}
else
{
if (pospar==0)
{
gotoxy (15,11);
printf (" No se han introducido n<>meros pares.");
}
else
{
gotoxy (15,10);
printf (" El mayor par introducido es: %d.",mayorpar);
gotoxy (15,11);
printf (" Se ha introducido en la %d<> posici<63>n.",pospar);
}
if (posmenor6==0)
{
gotoxy (15,12);
printf (" No se han introducido m<>ltiplos de 6.");
}
else
{
gotoxy (15,13);
printf (" El menor m<>ltiplo de 6 introducido es: %d.",menor6);
gotoxy (15,14);
printf (" Se ha introducido en la %d<> posici<63>n.",posmenor6);
}
if (posmayor==0)
{
gotoxy (15,13);
printf (" Los n<>meros introducidos son iguales.");
}
else
{
gotoxy (15,16);
printf (" El mayor n<>mero introducido es: %d.",mayor);
gotoxy (15,17);
printf (" Se ha introducido en la %d<> posici<63>n.",posmayor);
}
}
fflush (stdin);
scanf ("%c",&pausa);
}

96
CPP/PROG5.CPP Normal file
View File

@ -0,0 +1,96 @@
// Prog5
//
// Programadores:
//
// Juan L<>pez Fern<72>ndez
// Mois<69>s Virumbrales Cuenca
// DAI 1<>A
//
// Pedir n<>meros hasta que se introduzcan tres m<>ltiplos de 7 (no
// necesariamente consecutivos) <20> dos n<>meros impares consecutivos.
// Imprimir el mayor valor introducido y su posici<63>n.
#include <stdio.h>
#include <conio.h>
int mayor,posmayor,con,con7,conimpar,sw,num;
char pausa;
void main()
{
mayor=-32768;posmayor=0;con=0,con7=0;conimpar=0;sw=0;num=0;
clrscr();
gotoxy (20,16);
printf ("(Para finalizar introduzca");
gotoxy (20,17);
printf ("tres m<>ltiplos de siete o");
gotoxy (20,18);
printf ("dos impares consecutivos)");
gotoxy (20,13);
printf (" Introduce un n<>mero: ");
textcolor (4);
fflush(stdin);
cscanf ("%d",&num);
textcolor(7);
while (sw==0)
{
con++;
if (num %7==0)
{
con7++;
if (con7==3)
{
sw=1;
}
}
if (num %2!=0)
{
conimpar++;
if (conimpar==2)
{
sw=1;
}
}
else
{
conimpar=0;
}
if (num>mayor)
{
mayor=num; posmayor=con;
}
if (sw==0)
{
clrscr();
gotoxy (20,16);
printf ("(Para finalizar introduzca");
gotoxy (20,17);
printf ("tres m<>ltiplos de siete o");
gotoxy (20,18);
printf ("dos impares consecutivos)");
gotoxy (20,13);
printf (" Introduce un n<>mero: ");
textcolor (4);
fflush(stdin);
cscanf ("%d",&num);
textcolor(7);
}
}
clrscr();
gotoxy (20,12);
printf (" El mayor n<>mero introducido es: ");
textcolor (14);
cprintf ("%d",mayor);
printf (".");
gotoxy (20,13);
printf (" Se ha introducido en la ");
cprintf ("%d<>",posmayor);
printf (" posici<63>n.");
fflush (stdin);
scanf ("%c",&pausa);
}

177
CPP/PROG6.CPP Normal file
View File

@ -0,0 +1,177 @@
// Prog6
//
// Programadores:
//
// Juan L<>pez Fern<72>ndez
// Mois<69>s Virumbrales Cuenca
// DAI 1<>A
//
// Imprime una pir<69>mide de asteriscos seg<65>n las opciones tecleadas
// por el usuario.
//
// Descripci<63>n de las variables:
// num: N<>mero de asteriscos de la base.
// altura: N<>mero de filas de la pir<69>mide.
// posx, posy: Posici<63>n del cursor para imprimir asteriscos.
// conposx: Contador que lleva el n<>mero de asteriscos imprimidos por fila.
// conposy: Contador que lleva el n<>mero de filas imprimidas.
// color, color2, colorg: Guarda colores introducidos por usuario.
// conveces: Cuenta las veces que se introduce un color
// nveces: Marca las veces que se realiza el bucle dependiendo si es
// Monocolor o Bicolor.
// tipo: Tipo de pir<69>mide (normal o invertida)
// pausa: Para hacer una pausa al final del programa.
// ncolores: Guarda si es Monocolor o Bicolor.
// tipocolor: Forma de colorearlo (por filas o asteriscos).
#include <stdio.h>
#include <conio.h>
int num;
int altura;
int posx,posy;
int conposx,conposy;
int color,color2,colorg;
int conveces,nveces;
char tipo,pausa,ncolores,tipocolor;
void main()
{
do
{
clrscr();
gotoxy (17,13);
printf ("Introduce el N<> de asteriscos de la base: ");
fflush (stdin);
scanf ("%d",&num);
}
while (num %2!=0 || num<1 || num>50);
do
{
clrscr();
gotoxy(20,12);
printf (" Tipo de pir<69>mide (Normal o Invertida): ");
fflush (stdin);
scanf ("%c",&tipo);
}
while (tipo!='n' && tipo!='i');
do
{
clrscr();
gotoxy (20,12);
printf (" Monocolor o Bicolor: ");
fflush (stdin);
scanf ("%c",&ncolores);
}
while (ncolores!='m' && ncolores!='b');
if (ncolores=='m')
{
nveces=1;
}
else
{
nveces=2;
do
{
clrscr();
gotoxy(20,12);
printf (" Colorear por Filas o por Asteriscos: ");
fflush(stdin);
scanf ("%c",&tipocolor);
}
while (tipocolor!='f' && tipocolor!='a');
}
conveces=1;
do
{
if (nveces==2)
{
color2=color;
}
clrscr();
gotoxy (25,8); printf (" 1.- Azul");
gotoxy (25,9); printf (" 2.- Verde");
gotoxy (25,10); printf (" 3.- Cyan");
gotoxy (25,11); printf (" 4.- Rojo");
gotoxy (25,12); printf (" 5.- Morado");
gotoxy (25,13); printf (" 6.- Marr<72>n");
gotoxy (25,14); printf (" 7.- Gris claro");
gotoxy (25,15); printf (" 8.- Gris oscuro");
gotoxy (25,16); printf (" 9.- Azul claro");
gotoxy (25,17); printf ("10.- Verde claro");
gotoxy (25,18); printf ("11.- Cyan claro");
gotoxy (25,19); printf ("12.- Rojo claro");
gotoxy (25,20); printf ("13.- Morado claro");
gotoxy (25,21); printf ("14.- Amarillo");
gotoxy (25,22); printf ("15.- Blanco");
gotoxy (20,6);
printf (" Elige color %d<>: ",conveces);
fflush(stdin);
scanf ("%d",&color);
conveces++;
}
while (color<1 || color>15 || conveces<=nveces);
altura=(num/2);
posx=((80-num)/2);
if (tipo=='n')
{
posy=(25-((25-altura)/2));
}
else
{
posy=((26-(altura-1))/2);
}
clrscr();
textcolor(color);
for (conposy=1;conposy<=altura;conposy++)
{
gotoxy(posx,posy);
if (tipocolor=='f')
{
colorg=color;color=color2;color2=colorg;
textcolor(colorg);
}
for (conposx=1;conposx<=num;conposx++)
{
if (tipocolor=='a')
{
colorg=color;color=color2;color2=colorg;
textcolor (colorg);
}
cprintf ("*");
}
if (tipo=='n')
{
posy--;
}
else
{
posy++;
}
num=num-2;
posx++;
}
textcolor(7);
gotoxy(80,25);
fflush (stdin);
scanf ("%c",&pausa);
}

124
CPP/PROG7.CPP Normal file
View File

@ -0,0 +1,124 @@
// Prog7
//
// Programadores:
//
// Juan L<>pez Fern<72>ndez
// Mois<69>s Virumbrales Cuenca
// DAI 1<>A
//
// Pinta una espiral con el caracter introducido y pinta sus diagonales.
#include <stdio.h>
#include <conio.h>
char direccion;
char caracter;
int pos_x,pos_y,avanza,con,veces,avanzamas,sw;
void main()
{
clrscr();
gotoxy (20,11);
printf ("Introduzca el car<61>cter a imprimir: ");
fflush (stdin);
cscanf ("%c", &caracter);
//gotoxy (20,12);
//printf ("Introduzca el sentido inicial: ");
//fflush(stdin);
//scanf("%c",&direccion_inicial);
clrscr();
direccion='e';
pos_x=40;
pos_y=12;
avanza=1;
//avanzamas=15;
gotoxy (pos_x,pos_y);
printf ("%c",caracter);
do
{
for (con=1;con<=2;con++)
{
for (veces=1;direccion=='e' && veces<=avanza;veces++)
{
gotoxy(pos_x,pos_y);
printf("%c",caracter);
pos_x++;
if (pos_x==50)
{
sw=1;
direccion='p';
}
}
for (veces=1;direccion=='o' && veces<=avanza;veces++)
{
gotoxy(pos_x,pos_y);
printf("%c",caracter);
pos_x--;
}
for (veces=1;direccion=='n' && veces<=avanza;veces++)
{
gotoxy(pos_x,pos_y);
printf("%c",caracter);
pos_y--;
}
for (veces=1;direccion=='s' && veces<=avanza;veces++)
{
gotoxy(pos_x,pos_y);
printf("%c",caracter);
pos_y++;
}
getch();
// Cambio de direcciones.
if (direccion=='e')
{
direccion='s';
}
else
{
if (direccion=='o')
{
direccion='n';
}
else
{
if (direccion=='n')
{
direccion='e';
}
else
{
if (direccion=='s')
{
direccion='o';
}
}
}
}
}
//avanzamas++;
avanza++;
}
while (sw==0);
gotoxy(80,25);
getch();
pos_x=31;
pos_y=3;
for(con=1;con<=19;con++,pos_x++,pos_y++)
{
gotoxy (pos_x,pos_y);
textcolor(14);
cprintf ("%c",caracter);
}
getch();
pos_x=49;
pos_y=3;
for(con=1;con<=19;con++,pos_x--,pos_y++)
{
if (pos_x!=40)
{
gotoxy (pos_x,pos_y);
textcolor(1);
cprintf ("%c",caracter);
}
}
getch();
}

63
CPP/PROG8.CPP Normal file
View File

@ -0,0 +1,63 @@
// Prog8
//
// Programadores:
//
// Juan L<>pez Fern<72>ndez
// Mois<69>s Virumbrales Cuenca
// DAI 1<>A
//
#include <stdio.h>
#include <conio.h>
char direccion;
char caracter;
int pos_x,pos_y,con;
void main()
{
clrscr();
gotoxy (20,11);
printf ("Introduzca el car<61>cter a imprimir: ");
fflush (stdin);
cscanf ("%c", &caracter);
clrscr();
direccion='d';
pos_x=1;
pos_y=1;
for (;pos_y<=24;pos_y++)
{
for (con=1;con<=80;con++)
{
if (direccion=='d')
{
gotoxy(pos_x,pos_y);
printf ("%c",caracter);
pos_x++;
}
else
{
gotoxy(pos_x,pos_y);
printf ("%c",caracter);
pos_x--;
}
if (con==40)
{
getch();
}
}
getch();
if (direccion=='d')
{
direccion='i';
pos_x--;
}
else
{
direccion='d';
pos_x++;
}
}
gotoxy(1,25);
printf ("Pulse una tecla para finalizar...");
getch();
}

613
CPP/PROG9.CPP Normal file
View File

@ -0,0 +1,613 @@
// Prog9
//
// Programadores:
//
// Juan L<>pez Fern<72>ndez
// Mois<69>s Virumbrales Cuenca
// DAI 1<>A
//
// Juego de las tres en raya.
#include<stdio.h>
#include<conio.h>
int pos_x,pos_y,jfila,jcolumna;
int sw1,sw2,sw3,sw4,sw5,sw6,sw7,sw8,sw9;
int con,conaux;
int turno,turnoaux;
int lugar,tablalugar [3][3];
int ganar;
int vaciaf,vaciac;
char jugador1[8],jugador2[8];
char continua;
int limpia;
char fichaX [5][5],ficha0 [5][5];
int win1,win2;
void main()
{
// Inicializaci<63>n de funciones.
char pintar(int pos_x,int pos_y, int turno, int color);
char tablero();
char borrar(int pos_y);
int comprobar(int turno);
char leerdatos();
char pantalla(char jugador1[8],char jugador2[8]);
// Inicializaci<63>n de la ficha X.
fichaX [0][0]='<EFBFBD>';fichaX [0][4]='<EFBFBD>';fichaX [1][1]='<EFBFBD>';fichaX [1][3]='<EFBFBD>';
fichaX [3][1]='<EFBFBD>';fichaX [3][3]='<EFBFBD>';fichaX [4][0]='<EFBFBD>';fichaX [4][4]='<EFBFBD>';
fichaX [2][2]='<EFBFBD>';
// Inicializaci<63>n de la ficha 0.
ficha0 [0][2]='<EFBFBD>';ficha0 [1][1]='<EFBFBD>';ficha0 [1][3]='<EFBFBD>';ficha0 [2][0]='<EFBFBD>';
ficha0 [2][4]='<EFBFBD>';ficha0 [3][1]='<EFBFBD>';ficha0 [3][3]='<EFBFBD>';ficha0 [4][2]='<EFBFBD>';
// Introducci<63>n de datos
leerdatos();
do
{
// Pantalla general
if (continua!='s')
{
pantalla(jugador1,jugador2);
}
tablero();
if (turno==1 && continua=='s')
{
if (ganar==1)
{
win1++;
gotoxy (17,2);
printf ("Partidas ganadas: %d",win1);
}
turno=2;
borrar(24);
textcolor (7);
gotoxy (17,24);
cprintf ("Es el turno de ");
textcolor(2+BLINK);
cprintf ("%s",jugador2);
}
else
{
if (turno==2 && continua=='s')
{
if (ganar==2)
{
win2++;
gotoxy (45,2);
printf ("Partidas ganadas: %d",win2);
}
turno=1;
borrar(24);
textcolor (7);
gotoxy (17,24);
cprintf ("Es el turno de ");
textcolor(14+BLINK);
cprintf ("%s",jugador1);
}
}
// El programa.
for (vaciaf=0;vaciaf<3;vaciaf++)
{
for (vaciac=0;vaciac<3;vaciac++)
{
tablalugar[vaciaf][vaciac]=0;
}
}
sw1=0;sw2=0;sw3=0;sw4=0;sw5=0;sw6=0;sw7=0;sw8=0;sw9=0;
conaux=1;
lugar=0;
for (con=1,ganar=0;con<=9;con++)
{
con=conaux;
gotoxy (79,25);
fflush(stdin);
textcolor(0);
cscanf("%1d",&lugar);
if (lugar==1 && sw1==0)
{
pos_x=22;pos_y=17;
sw1=1;
if (turno==1)
{
tablalugar [0][2]=1;
}
else
{
tablalugar [0][2]=2;
}
}
else
{
if (lugar==2 && sw2==0)
{
pos_x=38;pos_y=17;
sw2=1;
if (turno==1)
{
tablalugar [1][2]=1;
}
else
{
tablalugar [1][2]=2;
}
}
else
{
if (lugar==3 && sw3==0)
{
pos_x=54;pos_y=17;
sw3=1;
if (turno==1)
{
tablalugar [2][2]=1;
}
else
{
tablalugar [2][2]=2;
}
}
else
{
if (lugar==4 && sw4==0)
{
pos_x=22;pos_y=11;
sw4=1;
if (turno==1)
{
tablalugar [0][1]=1;
}
else
{
tablalugar [0][1]=2;
}
}
else
{
if (lugar==5 && sw5==0)
{
pos_x=38;pos_y=11;
sw5=1;
if (turno==1)
{
tablalugar [1][1]=1;
}
else
{
tablalugar [1][1]=2;
}
}
else
{
if (lugar==6 && sw6==0)
{
pos_x=54;pos_y=11;
sw6=1;
if (turno==1)
{
tablalugar [2][1]=1;
}
else
{
tablalugar [2][1]=2;
}
}
else
{
if (lugar==7 && sw7==0)
{
pos_x=22;pos_y=5;
sw7=1;
if (turno==1)
{
tablalugar [0][0]=1;
}
else
{
tablalugar [0][0]=2;
}
}
else
{
if (lugar==8 && sw8==0)
{
pos_x=38;pos_y=5;
sw8=1;
if (turno==1)
{
tablalugar [1][0]=1;
}
else
{
tablalugar [1][0]=2;
}
}
else
{
if (lugar==9 && sw9==0)
{
pos_x=54;pos_y=5;
sw9=1;
if (turno==1)
{
tablalugar [2][0]=1;
}
else
{
tablalugar [2][0]=2;
}
}
else
{
borrar (24);
textcolor (7);
gotoxy (17,24);
cprintf ("Esa casilla est<73> ocupada, pierde turno.");
fflush (stdin);
getch();
conaux=con;
turnoaux=turno;
turno=0;
}
}
}
}
}
}
}
}
}
comprobar(turno);
// Pintar la ficha correspondiente.
if (turno==1 && ganar==0)
{
pintar(pos_x,pos_y,turno,14);
}
else
{
if (turno==2 && ganar==0)
{
pintar(pos_x,pos_y,turno,2);
}
}
// Siguiente turno.
if (turno==2 && con!=9 && ganar==0)
{
borrar(24);
textcolor (7);
gotoxy (17,24);
cprintf ("Es el turno de ");
textcolor(14+BLINK);
cprintf ("%s",jugador1);
turno=1;
conaux++;
}
else
{
if (turno==1 && con!=9 && ganar==0)
{
borrar(24);
textcolor (7);
gotoxy (17,24);
cprintf ("Es el turno de ");
textcolor(2+BLINK);
cprintf ("%s",jugador2);
turno=2;
conaux++;
}
else
{
if (turnoaux==2 && con!=9 && ganar==0)
{
borrar(24);
textcolor (7);
gotoxy (17,24);
cprintf ("Es el turno de ");
textcolor(14+BLINK);
cprintf ("%s",jugador1);
turno=1;
}
else
{
if (turnoaux==1 && con!=9 && ganar==0)
{
borrar(24);
textcolor (7);
gotoxy (17,24);
cprintf ("Es el turno de ");
textcolor(2+BLINK);
cprintf ("%s",jugador2);
turno=2;
}
}
}
}
if (con==9 && ganar==0)
{
borrar(24);
gotoxy (17,24);
textcolor(7);
cprintf ("Partida finalizada.");
fflush(stdin);
getch();
}
if (ganar==1)
{
borrar(24);
gotoxy (17,24);
textcolor (14+BLINK);
cprintf ("<EFBFBD><EFBFBD> Ha ganado %s !!",jugador1);
con=10;
fflush (stdin);
getch();
}
else
{
if (ganar==2)
{
borrar(24);
gotoxy (17,24);
textcolor (10+BLINK);
cprintf ("<EFBFBD><EFBFBD> Ha ganado %s !!",jugador2);
con=10;
fflush (stdin);
getch();
}
}
}
borrar(24);
gotoxy (17,24);
textcolor(7);
cprintf ("<EFBFBD>Desea jugar otra vez? ");
fflush(stdin);
cscanf ("%s",&continua);
}
while (continua!='n');
fflush (stdin);
getch();
clrscr();
textcolor (7);
}
// Funci<63>n pintar
char pintar(int pos_x,int pos_y,int turno,int color)
{
for (jfila=0;jfila<=4;jfila++)
{
for (jcolumna=0;jcolumna<=4;jcolumna++)
{
gotoxy (jcolumna+pos_x,jfila+pos_y);
if (turno==1)
{
if (fichaX[jfila][jcolumna]=='<EFBFBD>')
{
textcolor (color);
cprintf ("%c",fichaX[jfila][jcolumna]);
}
}
else
{
if (turno==2)
{
if (ficha0[jfila][jcolumna]=='<EFBFBD>')
{
textcolor (color);
cprintf ("%c",ficha0[jfila][jcolumna]);
}
}
}
}
}
return(0);
}
// Funci<63>n tablero
char tablero()
{
// Fondo tablero.
for (pos_x=15,pos_y=4;pos_y<=22;)
{
textcolor(7);
gotoxy(pos_x,pos_y);
cprintf("<EFBFBD>");
if (pos_x!=65)
{
pos_x++;
}
else
{
pos_x=15;
pos_y++;
}
}
// Recuadro tablero y lineas interior.
for (pos_x=15;pos_x<=65;pos_x++)
{
textcolor (1);
gotoxy (pos_x,4);cprintf ("<EFBFBD>");
gotoxy (pos_x,22);cprintf ("<EFBFBD>");
gotoxy (pos_x,10);cprintf ("<EFBFBD>");
gotoxy (pos_x,16);cprintf ("<EFBFBD>");
}
for (pos_y=4;pos_y<=22;pos_y++)
{
textcolor (1);
gotoxy (15,pos_y);cprintf ("<EFBFBD>");
gotoxy (16,pos_y);cprintf ("<EFBFBD>");
gotoxy (65,pos_y);cprintf ("<EFBFBD>");
gotoxy (64,pos_y);cprintf ("<EFBFBD>");
gotoxy (32,pos_y);cprintf ("<EFBFBD>");
gotoxy (48,pos_y);cprintf ("<EFBFBD>");
}
return(0);
}
// Borrador de l<>nea
char borrar(int pos_y)
{
for (limpia=1;limpia<=80;limpia++)
{
gotoxy (limpia,pos_y);
textcolor (0);
cprintf ("<EFBFBD>");
}
return (0);
}
// Comprobaci<63>n de tres en raya
int comprobar(int turno)
{
if (turno!=0)
{
if (tablalugar[0][0]==turno)
{
if (tablalugar[1][0]==turno)
{
if (tablalugar[2][0]==turno)
{
ganar=turno;
pintar(22,5,turno,4+BLINK);pintar(38,5,turno,4+BLINK);
pintar(54,5,turno,4+BLINK);
}
}
else
{
if (tablalugar[1][1]==turno)
{
if (tablalugar[2][2]==turno)
{
ganar=turno;
pintar(22,5,turno,4+BLINK);pintar(38,11,turno,4+BLINK);
pintar(54,17,turno,4+BLINK);
}
}
else
{
if (tablalugar[0][1]==turno)
{
if (tablalugar[0][2]==turno)
{
ganar=turno;
pintar(22,5,turno,4+BLINK);pintar(22,11,turno,4+BLINK);
pintar(22,17,turno,4+BLINK);
}
}
}
}
}
if (tablalugar[2][0]==turno)
{
if (tablalugar[2][1]==turno)
{
if (tablalugar[2][2]==turno)
{
ganar=turno;
pintar(54,5,turno,4+BLINK);pintar(54,11,turno,4+BLINK);
pintar(54,17,turno,4+BLINK);
}
}
else
{
if (tablalugar[1][1]==turno)
{
if (tablalugar[0][2]==turno)
{
ganar=turno;
pintar(54,5,turno,4+BLINK);pintar(38,11,turno,4+BLINK);
pintar(22,17,turno,4+BLINK);
}
}
}
}
if (tablalugar[2][2]==turno)
{
if (tablalugar[1][2]==turno)
{
if (tablalugar[0][2]==turno)
{
ganar=turno;
pintar(22,17,turno,4+BLINK);pintar(38,17,turno,4+BLINK);
pintar(54,17,turno,4+BLINK);
}
}
}
if (tablalugar[1][0]==turno)
{
if (tablalugar[1][1]==turno)
{
if (tablalugar[1][2]==turno)
{
ganar=turno;
pintar(38,5,turno,4+BLINK);pintar(38,11,turno,4+BLINK);
pintar(38,17,turno,4+BLINK);
}
}
}
if (tablalugar[0][1]==turno)
{
if (tablalugar[1][1]==turno)
{
if (tablalugar[2][1]==turno)
{
ganar=turno;
pintar(22,11,turno,4+BLINK);pintar(38,11,turno,4+BLINK);
pintar(54,11,turno,4+BLINK);
}
}
}
}
return(ganar);
}
// Datos
char leerdatos()
{
clrscr();
textcolor(7);
gotoxy (20,11);
cprintf ("Nombre jugador 1: ");
fflush(stdin);
cscanf("%8s",&jugador1);
gotoxy (20,13);
cprintf ("Nombre jugador 2: ");
fflush(stdin);
cscanf("%8s",&jugador2);
return (jugador1[8],jugador2[8]);
}
// Pantalla general
char pantalla(char jugador1[8],char jugador2[8])
{
clrscr();
gotoxy (17,1);
textcolor(14);
cprintf ("X ");textcolor (7);cprintf ("-> %s",jugador1);
gotoxy (53,1);
textcolor (2);
cprintf ("O ");textcolor (7);cprintf ("-> %s",jugador2);
gotoxy (17,24);
printf ("Es el turno de ");
textcolor(14+BLINK);
cprintf ("%s",jugador1);
turno=1;
return(turno);
}

5
CPP/PRUEBA.C Normal file
View File

@ -0,0 +1,5 @@
#include <stdio.h>
void main(){
printf("Hola Mundo");
}

59
CPP/PRUEBA.CPP Normal file
View File

@ -0,0 +1,59 @@
// Prog10
//
// Programadores:
//
// Juan L<>pez Fern<72>ndez
// Mois<69>s Virumbrales Cuenca
// DAI 1<>A
//
// Program que introducido un n<>mero decimal, lo cambia a la base
// introducida.
#include<stdio.h>
#include<conio.h>
#define A 10
#define B 11
#define C 12
#define D 13
#define E 14
#define F 15
#define a 10
#define b 11
#define c 12
#define d 13
#define e 14
#define f 15
int tabla[15];
void leer_datos ();
void main () {
leer_datos;
//verificar
//pasar_base10
//pasar_base_elegida
//mostrar_resultados
fflush(stdin);
getch();
}
// Funci<63>n de leer datos.
void leer_datos () {
int num,con=0;
do {
fflush(stdin);
cscanf("%1d",&num);
if (num>=0 && num <=15) {
tabla[con]=num;
con++;
}
}
while (num<=0 && num >=15 && con >15);
}

BIN
CPP/PRUEBA.E Normal file

Binary file not shown.

BIN
CPP/PRUEBA.O Normal file

Binary file not shown.

39
CPP/PUNTERO.CPP Normal file
View File

@ -0,0 +1,39 @@
#include<stdio.h>
#include<conio.h>
#include<dos.h>
void borrar(int pos_y);
void main(){
int i=0,*p,tabla[10];int x,y;
textcolor(7);textbackground(0);
clrscr();
for (i=0;i<10;i++)
tabla[i]=i+1;
for (i=0;i<10;i++){
printf("\n Inizializaci<63>n de la cuenta atras... %2d",tabla[i]);delay(100);
}
printf("\n");
p=&tabla[9];
for (;p>=&tabla[0];p--){
printf("\n Cuenta atras... %2d",*p);delay(1000);
}
printf("\n\n CERO, DESPEGUE");
for (i=60;i>1;i--){
printf(".");delay(i);
if (i==50){
x=wherex();y=wherey();
gotoxy(3,25);textcolor(12+BLINK);cprintf("Lo perdemos, lo perdemos...");
gotoxy(x,y);
}
}
borrar(25);textcolor(7);gotoxy(3,24);cprintf(" Se nos fue...");
getch();
}
void borrar(int pos_y){
for (int limpia=1;limpia<=80;limpia++){
gotoxy (limpia,pos_y);
textcolor (0);
cprintf ("<EFBFBD>");
}
}

20
CPP/SEPETA.CPP Normal file
View File

@ -0,0 +1,20 @@
// PROGRAMA QUE IMPLEMENTA LAS FUNCIONES
#include <stdio.h>
#include <conio.h>
char var,c;
void main()
{
textbackground(2);
clrscr();
textcolor(4);
gotoxy(20,10);
cprintf("Hola Tron, dame un valor: ");
cscanf("%c", &var);
gotoxy(20,12);
printf("El valor es: %c",var);
scanf("%c",&c);
}

102
CPP/TEMP.CPP Normal file
View File

@ -0,0 +1,102 @@
// Prog7
//
// Programadores:
//
// Juan L<>pez Fern<72>ndez
// Mois<69>s Virumbrales Cuenca
// DAI 1<>A
//
#include <stdio.h>
#include <conio.h>
char direccion;
char caracter;
int pos_x,pos_y,avanza,con,veces;
void main()
{
clrscr();
gotoxy (20,11);
printf ("Introduzca el car<61>cter a imprimir: ");
fflush (stdin);
cscanf ("%c", &caracter);
//gotoxy (20,12);
//printf ("Introduzca el sentido inicial: ");
//fflush(stdin);
//scanf("%c",&direccion_inicial);
clrscr();
direccion='e';
pos_x=40;
pos_y=12;
avanza=1;
gotoxy (pos_x,pos_y);
printf ("%c",caracter);
textcolor(14);
do
{
for (con=1;con<=2;con++)
{
for (veces=1;direccion=='e' && veces<=avanza;veces++)
{
gotoxy(pos_x,pos_y);
textcolor(2);
cprintf("%c",caracter);
pos_x++;
}
for (veces=1;direccion=='o' && veces<=avanza;veces++)
{
gotoxy(pos_x,pos_y);
textcolor(14);
cprintf("%c",caracter);
pos_x--;
}
for (veces=1;direccion=='n' && veces<=avanza;veces++)
{
gotoxy(pos_x,pos_y);
textcolor(13);
cprintf("%c",caracter);
pos_y--;
}
for (veces=1;direccion=='s' && veces<=avanza;veces++)
{
gotoxy(pos_x,pos_y);
textcolor(12);
cprintf("%c",caracter);
pos_y++;
}
getch();
// Cambio de direcciones.
if (direccion=='e')
{
direccion='s';
}
else
{
if (direccion=='o')
{
direccion='n';
}
else
{
if (direccion=='n')
{
direccion='e';
}
else
{
if (direccion=='s')
{
direccion='o';
}
}
}
}
}
avanza++;
}
while (pos_y>0);
gotoxy(80,25);
getch();
}

128
CPP/TEST.CPP Normal file
View File

@ -0,0 +1,128 @@
// ************************************************************************************************
//
// Direct X TEST.
//
// ************************************** (c) Pedro D<>ez L<>pez ************************************
#include "DXVideo.h"
#define ID_NOMBRE "Test"
#define ID_TITULO "Test"
#define ID_TEMP 1
CDXVideo *DXVideo;
BOOL Par;
int Temporizador;
BOOL AppActiva;
//
// El TEST
//
void Test ()
{
if(Par==TRUE)
{
memset(DXVideo->pBuffer.bpp,064,DXVideo->DimBuffer);
Par = FALSE;
}
else
{
memset(DXVideo->pBuffer.bpp,128,DXVideo->DimBuffer);
Par = TRUE;
}
}
//
//
// W i n d o w P r o c
//
//
long FAR PASCAL WindowProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch( message )
{
case WM_ACTIVATEAPP:
AppActiva = (wParam == WA_ACTIVE) || (wParam == WA_CLICKACTIVE);
break;
case WM_CREATE:
break;
case WM_SETCURSOR:
SetCursor(DXVideo->mDDCursorShape);
return TRUE;
case WM_TIMER:
if (AppActiva && ID_TEMP == wParam)
{
Test();
DXVideo->Pinta();
}
break;
case WM_KEYDOWN:
switch( wParam )
{
case VK_ESCAPE:
PostMessage(hWnd, WM_CLOSE, 0, 0);
break;
}
break;
case WM_PAINT:
break;
case WM_DESTROY:
DXVideo->Fin();
delete DXVideo;
PostQuitMessage(0);
break;
}
return DefWindowProc(hWnd, message, wParam, lParam);
}
//
//
// W i n M a i n
//
//
int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
WNDCLASS wc;
HWND hwnd;
MSG msg;
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = WindowProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon(hInstance, IDI_APPLICATION);
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = NULL;
wc.lpszMenuName = ID_NOMBRE;
wc.lpszClassName = ID_NOMBRE;
RegisterClass(&wc);
hwnd = CreateWindowEx(WS_EX_TOPMOST,ID_NOMBRE,ID_TITULO,WS_POPUP,0,0,
GetSystemMetrics(SM_CXSCREEN),GetSystemMetrics(SM_CYSCREEN),
NULL, NULL, hInstance, NULL);
if (!hwnd) return FALSE;
ShowWindow(hwnd, nCmdShow);
UpdateWindow(hwnd);
Temporizador = 100;
if(!SetTimer(hwnd,ID_TEMP,Temporizador,NULL)) return FALSE;
DXVideo = new CDXVideo;
DXVideo->Inicio (hwnd,640,480,16);
DXVideo->Cursor(NULL);
while (GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
return msg.wParam;
}

36
CPP/VENTANA.CPP Normal file
View File

@ -0,0 +1,36 @@
#include<stdio.h>
#include<conio.h>
char ventana (int ancho,int largo,int color_g,int color_borde,char titulo,
int color_titulo,int posx,int posy);
void main() {
clrscr();
ventana(40,10,7,1,'P',14,30,7);
fflush(stdin);
getch();
}
// Funci<63>n ventana.
char ventana (int ancho,int largo,int color_g,int color_borde,char titulo,
int color_titulo,int posx,int posy) {
int x,y,cony,conx;
char dib;
dib='<EFBFBD>';
for (cony=0,y=posy;cony<largo;cony++,y++){
for (conx=0,x=posx;conx<ancho;conx++,x++) {
gotoxy(x,y);
if (x==posx || y==posy || y==(posy+(largo-1)) || x==(posx+1)
|| x==(posx+(ancho-2)) || x==(posx+(ancho-1)))
textcolor(color_borde);
else
textcolor(color_g);
cprintf ("%c",dib);
}
}
gotoxy((posx+2),posy);
textcolor(color_titulo);
textbackground(color_borde);
cprintf("%c",titulo);
return(0);
}

375
CPP/VIDEO.BAK Normal file
View File

@ -0,0 +1,375 @@
#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include <dos.h>
#include <time.h>
#include "d:\progs_c\gui.h"
char titulo[80]={"Programa Gesti<74>n del VideoClub Alfa. Juan L<>pez Fern<72>ndez"};
int estoy_en=1;// Indica el men<65> en el que me encuentro.
int select_actual=1; // Indica que opci<63>n est<73> seleccionada actualmente.
int n_op_menu=5; // N<>mero de opciones del menu. (default menu1=5)
int refresco=1; // Para el calor... Refresca la pantalla :-).
int *p_estoy_en=&estoy_en;// -- Punteros a sus respectivas variables. --
int *p_select_actual=&select_actual;
int *p_n_op_menu=&n_op_menu;
int *p_refresco=&refresco;
// -------- Definici<63>n de los patrones o "templates" ---------------------
struct peliculas {
char titulo[20];
char tema[10];
int duracion;
int n_alquileres;
};
struct clientes {
int codigo;
char nombre[25];
};
struct alquileres {
struct peliculas lista_pelis[5];
struct clientes socios;
float fecha_dev;
char finalizado;
};
// ---------------- Fin de la definici<63>n de los patrones. -----------------
struct peliculas existencias[230]; // Declaraci<63>n de arrays
struct clientes socios[100]; // de estructuras.
struct alquileres prestamos[100]; // A nivel global.
void modo_grafico();
void menu(int, int);
void miga(int*, int*);
void localizacion(int, int, int);
void reloj(int, int);
void introcad(char cad[],int a,int x,int y,int c,int s,int t);
void altas_clientes(int);
//int bajas_clientes(struct, int, int);
//void modificar_clientes(struct, int, int);
// ***********************************************************************
// PROGRAMA PRINCIPAL
// ***********************************************************************
void main() {
// struct peliculas existencias[500]; // probablemente no est<73> aqu<71>.
// struct clientes socios[200];
// struct alquileres prestamos[200];
// <..inicializar las tablas..>.
modo_grafico();
//presentacion(); // Me pregunto si llegar<61> a hacerla... ;-).
menu(estoy_en, select_actual);
int tecla1, tecla12, sw=1;
while(sw==1){
reloj(423,100);
tecla1=getch();
if(tecla1==0) // leemos tecla especial.
{
tecla12=getch();
switch(tecla12) {
case 72: // Flecha arriba
if (select_actual<=1)
select_actual=1;
else {
select_actual--;
menu(estoy_en, select_actual);
}
break;
case 80: // Flecha abajo
if (select_actual>=n_op_menu)
select_actual=n_op_menu;
else{
select_actual++;
menu(estoy_en, select_actual);
}
break;
} // fin del switch-case
}// fin del if
else
if (tecla1==13) // MIGA DEL ASUNTO
{
miga(p_estoy_en, p_select_actual);
menu(estoy_en, select_actual);
}
else
if (tecla1==27)
if (estoy_en==1) // Se acab<61> la funci<63>n...
sw=0;
else // Navegaci<63>n descendente por men<65>s.
{
*p_estoy_en/=10;
*p_n_op_menu=5;
*p_select_actual=1;
*p_refresco=1;
menu(estoy_en,select_actual);
}
} // fin del while
// getch();
closegraph();
}
// ***********************************************************************
// --- FUNCIONES DEL PROGRAMA ---
// ***********************************************************************
// ------------------------------------------------------------------------
// FUNCI<43>N MIGA (MIGA DEL ASUNTO)
// (con punteros!, como mola...)
// ------------------------------------------------------------------------
void miga(int *p_estoy_en,int *p_select_actual) {
*p_refresco=1; // antes de nada tomemos una coca-cola... ;-)
switch (*p_estoy_en) // veamos que hay que hacer:
{
case 1: // naveguemos por los men<65>s: ir a menu 1.x
switch (*p_select_actual)
{
case 1:
*p_estoy_en=11;
*p_select_actual=1;
*p_n_op_menu=5;
break;
case 2:
*p_estoy_en=12;
*p_select_actual=1;
*p_n_op_menu=5;
break;
case 3:
*p_estoy_en=13;
*p_select_actual=1;
*p_n_op_menu=3;
break;
case 4:
*p_estoy_en=14;
*p_select_actual=1;
*p_n_op_menu=3;
break;
} // fin del switch-case(select_actual) de navegaci<63>n de men<65>s.
break;//fin del case 1 general.
case 11: // Estamos en las opciones del menu1.
switch (select_actual) // veamos que hay que hacer.
{
case 1: // ALTAS DE CLIENTES.
altas_clientes(200);
break;
}
break;
} // fin del switch-case(estoy_en) general (TOCHO).
} // fin de la funci<63>n miga
// -----------------------------------------------------------------------
// FUNCI<43>N QUE INICIA EL MODO GR<47>FICO
// -----------------------------------------------------------------------
void modo_grafico(){
int gdriver = DETECT, gmode, errorcode;
initgraph(&gdriver, &gmode, "c:\\tc\\bgi");
errorcode = graphresult();
if (errorcode != grOk){
printf("Error al iniciar el modo gr<67>fico: %s\n",
grapherrormsg(errorcode));
printf("Pulse cualquier tecla1 para finalizar...");
getch();
exit(1);
}
}
// -----------------------------------------------------------------------
// FUNCION MENU
// -----------------------------------------------------------------------
void menu(int estoy_en, int select_actual) {
//-------------------- CABECERA DE LA PANTALLA -----------------------
if (*p_refresco) // tomamos otro refresco... (ahora una fanta lim<69>n).
{
setviewport(0, 0, getmaxx(), getmaxy(), 0);
settextstyle(2, 0, 5);
ventana(1, 1, getmaxx(), getmaxy(), 1, 9, titulo);
boton(5, 30, getmaxx()-5, 80, 3, 0, "", 9);
setcolor(8); line(5, 90, getmaxx()-5, 90); // dibujamos una doble
setcolor(15); line(5, 91, getmaxx()-5, 91); // l<>nea.
settextstyle(7,0,6); setcolor (1); // caja central con nuestro
outtextxy(110,23,"Video Club ALFA"); // logo del videoclub.
setcolor(8); line(5, 134, getmaxx()-5, 134); // dibujamos otra doble
setcolor(15); line(5, 135, getmaxx()-5, 135); // l<>nea.
localizacion(estoy_en,125,105); // mostramos en una barra donde estamos
*p_refresco=0; // demasiadas burbujas...
}
//----------------- fin de la cabecera de la pantalla ------------------
setviewport(110, 180, 600, 300, 0); // zona de los botones.
switch (estoy_en) // Mostramos un men<65> seg<65>n donde estemos.
{
case 1: // ------------- MENU PRINCIPAL ------------------------------
settextstyle(2,0,6);
boton(0, 5, 250, 30, 7, 0, "1.- Gesti<74>n de Clientes", 16);
boton(0, 45, 250, 70, 7, 0, "2.- Gesti<74>n de Pedidos", 16);
boton(0, 85, 250, 110, 7, 0, "3.- Alquileres", 16);
boton(0, 125, 250, 150, 7, 0, "4.- Devoluciones", 16);
boton(0, 165, 250, 190, 7, 0, "5.- Salir", 16);
break;
case 11: // ---------------- MENU CLIENTES ---------------------------
settextstyle(2,0,6);
boton(0, 5, 250, 30, 7, 0, "1.- Altas de Clientes", 16);
boton(0, 45, 250, 70, 7, 0, "2.- Bajas de Clientes", 16);
boton(0, 85, 250, 110, 7, 0, "3.- Modificaciones", 16);
boton(0, 125, 250, 150, 7, 0, "4.- Listado de clientes", 16);
boton(0, 165, 250, 190, 7, 0, "5.- Salir", 16);
break;
case 12: // ------------- MENU GESTION DE PEDIDOS ---------------------
settextstyle(2,0,6);
boton(0, 5, 250, 30, 7, 0, "1.- Altas de Pel<65>culas", 16);
boton(0, 45, 250, 70, 7, 0, "2.- Bajas de Pel<65>culas", 16);
boton(0, 85, 250, 110, 7, 0, "3.- Modificaciones", 16);
boton(0, 125, 250, 150, 7, 0, "4.- Listado de datos", 16);
boton(0, 165, 250, 190, 7, 0, "5.- Salir", 16);
break;
case 13: //------------------ MENU 3: ALQUILERES --------------------
settextstyle(2,0,6);
boton(0, 5, 250, 30, 7, 0, "1.- Altas de Alquiler", 16);
boton(0, 45, 250, 70, 7, 0, "2.- Modificar", 16);
boton(0, 85, 250, 110, 7, 0, "3.- Volver", 16);
break;
case 14:// ------------------- MENU 4: DEVOLUCIONES ------------------
settextstyle(2,0,6);
boton(0, 5, 250, 30, 7, 0, "1.- Devoluciones", 16);
boton(0, 45, 250, 70, 7, 0, "2.- Modificaciones", 16);
boton(0, 85, 250, 110, 7, 0, "3.- Volver", 16);
break;
} //fin del switch-case(estoy_en).
setlinestyle(1,0,2);
switch (select_actual)// Ahora pintamos un recuadro al bot<6F>n seleccionado.
{
case 1:
rectangle(5,9,245,26);
setlinestyle(0,0,2);rectangle(0,5,250,30);
break;
case 2:
rectangle(5,49,245,66);
setlinestyle(0,0,2);rectangle(0,45,250,70);
break;
case 3:
rectangle(5, 89, 245, 106);
setlinestyle(0,0,2);rectangle(0,85,250,110);
break;
case 4:
rectangle(5, 129, 245, 146);
setlinestyle(0,0,2);rectangle(0,125,250,150);
break;
case 5:
rectangle(5,169, 245, 186);
setlinestyle(0,0,2);rectangle(0,165,250,190);
break;
} // fin del switch-case(select_actual).
setlinestyle(0,0,0); // volvemos a poner el estilo de l<>nea normal.
} // fin de la funci<63>n men<65>.
// ------------------------------------------------------------------------
// FUNCI<43>N LOCALIZACI<43>N
// ------------------------------------------------------------------------
void localizacion(int estoy_en, int x, int y) {
settextstyle(2,0,5);
boton(5,100,getmaxx()-225,124,7,1,"Localizaci<63>n:",8);
setcolor(1);
switch (estoy_en) {
case 1:
outtextxy(x,y,"Men<65> General");
break;
case 11:
outtextxy(x,y, "Men<65> General / Gesti<74>n de Clientes");
break;
case 12:
outtextxy(x,y, "Men<65> General / Gesti<74>n de Pedidos");
break;
case 13:
outtextxy(x,y, "Men<65> General / Alquileres");
break;
case 14:
outtextxy(x,y, "Men<65> General / Devoluciones");
break;
} // fin del switch-case
} // fin de la funci<63>n.
// ------------------------------------------------------------------------
// FUNCI<43>N RELOJ
// ------------------------------------------------------------------------
void reloj (int x, int y) {
setviewport(0,0,getmaxx(),getmaxy(),1);
time_t t;
time(&t);
settextstyle(2,0,5);
boton (x,y,x+210,y+25,7,0,ctime(&t),1);
}
// ------------------------------------------------------------------------
// FUNCI<43>N ALTAS DE CLIENTES
// ------------------------------------------------------------------------
void altas_clientes(int n) {
int j=0;
while (j<n && socios[j].codigo>0) j++;
if (j<n){
setviewport(300,150,getmaxx(),getmaxy(),0);
ventana(0,20,250,200,0,0,"Alta de Clientes");
introcad(socios[j].nombre,24,100,100,1,2,6);
socios[j].codigo=j;
}
else{
// imprimir tabla llena
}
} // fin de la funci<63>n altas_clientes
void introcad(char cad[],int a,int x,int y,int c,int s,int t){
int i;
for (i=0;i<=a-1;i++) {
if (i<a-1){
cad[i]=getche();cad[i+1]=NULL;
setcolor(c);settextstyle(s,0,t);outtextxy(x,y,cad);
}
else
if (i==a-1 && cad[i]!=13){
cad[i]=getche();
if (cad[i]!=13){
sound(1000);delay(50);nosound();
}
i--;
}
if (cad[i]==13){
cad[i]=NULL;
break;
}
}
}

1383
CPP/VIDEO.CPP Normal file

File diff suppressed because it is too large Load Diff

308
CPP/VIDEO2.CPP Normal file
View File

@ -0,0 +1,308 @@
#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include <dos.h>
#include <time.h>
#include "d:\progs_c\lib\gui.h"
char titulo[80]={"Programa Gesti<74>n del VideoClub Alfa. Juan L<>pez Fern<72>ndez"};
int estoy_en=1;// Indica el men<65> en el que me encuentro.
int select_actual=1; // Indica que opci<63>n est<73> seleccionada actualmente.
int n_op_menu=5; // N<>mero de opciones del menu. (default menu1=5)
int refresco=1; // Para el calor... Refresca la pantalla :-).
int *p_estoy_en=&estoy_en;// -- Punteros a sus respectivas variables. --
int *p_select_actual=&select_actual;
int *p_n_op_menu=&n_op_menu;
int *p_refresco=&refresco;
struct peliculas {
char titulo[20];
char tema[10];
int duracion;
int alquileres;
};
struct clientes {
int codigo;
char nombre[25];
};
struct alquileres {
struct peliculas lista_pelis[5];
struct clientes socio;
float fecha_dev;
char finalizado;
};
void modo_grafico();
void menu(int, int);
void miga(int*, int*);
void localizacion(int, int, int);
void reloj(int, int);
// ***********************************************************************
// PROGRAMA PRINCIPAL
// ***********************************************************************
void main() {
modo_grafico();
//presentacion(); // Me pregunto si llegar<61> a hacerla... ;-).
menu(estoy_en, select_actual);
int tecla1, tecla12, sw=1;
while(sw==1){
reloj(423,100);
tecla1=getch();
if(tecla1==0) // leemos tecla especial.
{
tecla12=getch();
switch(tecla12) {
case 72: // Flecha arriba
if (select_actual<=1)
select_actual=1;
else {
select_actual--;
menu(estoy_en, select_actual);
}
break;
case 80: // Flecha abajo
if (select_actual>=n_op_menu)
select_actual=n_op_menu;
else{
select_actual++;
menu(estoy_en, select_actual);
}
break;
} // fin del switch-case
}// fin del if
else
if (tecla1==13) // MIGA DEL ASUNTO
{
miga(p_estoy_en, p_select_actual);
menu(estoy_en, select_actual);
}
else
if (tecla1==27)
if (estoy_en==1) // Se acab<61> la funci<63>n...
sw=0;
else // Navegaci<63>n descendente por men<65>s.
{
*p_estoy_en/=10;
*p_n_op_menu=5;
*p_select_actual=1;
*p_refresco=1;
menu(estoy_en,select_actual);
}
} // fin del while
// getch();
closegraph();
}
// ***********************************************************************
// --- FUNCIONES DEL PROGRAMA ---
// ***********************************************************************
// ------------------------------------------------------------------------
// FUNCI<43>N MIGA (MIGA DEL ASUNTO)
// (con punteros!, como mola...)
// ------------------------------------------------------------------------
void miga(int *p_estoy_en,int *p_select_actual) {
*p_refresco=1; // antes de nada tomemos una coca-cola... ;-)
switch (*p_estoy_en) // veamos que hay que hacer:
{
case 1: // naveguemos por los men<65>s: ir a menu 1.x
switch (*p_select_actual)
{
case 1:
*p_estoy_en=11;
*p_select_actual=1;
*p_n_op_menu=5;
break;
case 2:
*p_estoy_en=12;
*p_select_actual=1;
*p_n_op_menu=5;
break;
case 3:
*p_estoy_en=13;
*p_select_actual=1;
*p_n_op_menu=3;
break;
case 4:
*p_estoy_en=14;
*p_select_actual=1;
*p_n_op_menu=3;
break;
} // fin del switch-case de navegaci<63>n de men<65>s.
break;//fin del case 1 general.
} // fin del switch-case general.
} // fin de la funci<63>n miga
// -----------------------------------------------------------------------
// FUNCI<43>N QUE INICIA EL MODO GR<47>FICO
// -----------------------------------------------------------------------
void modo_grafico(){
int gdriver = DETECT, gmode, errorcode;
initgraph(&gdriver, &gmode, "d:\\tc\\bgi");
errorcode = graphresult();
if (errorcode != grOk){
printf("Error al iniciar el modo gr<67>fico: %s\n",
grapherrormsg(errorcode));
printf("Pulse cualquier tecla1 para finalizar...");
getch();
exit(1);
}
}
// -----------------------------------------------------------------------
// FUNCION MENU
// -----------------------------------------------------------------------
void menu(int estoy_en, int select_actual) {
//-------------------- CABECERA DE LA PANTALLA -----------------------
if (*p_refresco) // tomamos otro refresco... (ahora una fanta lim<69>n).
{
setviewport(0, 0, getmaxx(), getmaxy(), 0);
settextstyle(2, 0, 5);
ventana(1, 1, getmaxx(), getmaxy(), 1, 9, titulo);
boton(5, 30, getmaxx()-5, 80, 3, 0, "", 9);
setcolor(8); line(5, 90, getmaxx()-5, 90); // dibujamos una doble
setcolor(15); line(5, 91, getmaxx()-5, 91); // l<>nea.
settextstyle(7,0,6); setcolor (1); // caja central con nuestro
outtextxy(110,23,"Video Club ALFA"); // logo del videoclub.
setcolor(8); line(5, 134, getmaxx()-5, 134); // dibujamos otra doble
setcolor(15); line(5, 135, getmaxx()-5, 135); // l<>nea.
localizacion(estoy_en,125,105); // mostramos en una barra donde estamos
*p_refresco=0; // demasiadas burbujas...
}
//----------------- fin de la cabecera de la pantalla ------------------
setviewport(110, 180, 600, 300, 0); // zona de los botones.
switch (estoy_en) // Mostramos un men<65> seg<65>n donde estemos.
{
case 1: // ------------- MENU PRINCIPAL ------------------------------
settextstyle(2,0,6);
boton(0, 5, 250, 30, 7, 0, "1.- Gesti<74>n de Clientes", 16);
boton(0, 45, 250, 70, 7, 0, "2.- Gesti<74>n de Pedidos", 16);
boton(0, 85, 250, 110, 7, 0, "3.- Alquileres", 16);
boton(0, 125, 250, 150, 7, 0, "4.- Devoluciones", 16);
boton(0, 165, 250, 190, 7, 0, "5.- Salir", 16);
break;
case 11: // ---------------- MENU CLIENTES ---------------------------
settextstyle(2,0,6);
boton(0, 5, 250, 30, 7, 0, "1.- Altas de Clientes", 16);
boton(0, 45, 250, 70, 7, 0, "2.- Bajas de Clientes", 16);
boton(0, 85, 250, 110, 7, 0, "3.- Modificaciones", 16);
boton(0, 125, 250, 150, 7, 0, "4.- Listado de clientes", 16);
boton(0, 165, 250, 190, 7, 0, "5.- Salir", 16);
break;
case 12: // ------------- MENU GESTION DE PEDIDOS ---------------------
settextstyle(2,0,6);
boton(0, 5, 250, 30, 7, 0, "1.- Altas de Pel<65>culas", 16);
boton(0, 45, 250, 70, 7, 0, "2.- Bajas de Pel<65>culas", 16);
boton(0, 85, 250, 110, 7, 0, "3.- Modificaciones", 16);
boton(0, 125, 250, 150, 7, 0, "4.- Listado de datos", 16);
boton(0, 165, 250, 190, 7, 0, "5.- Salir", 16);
break;
case 13: //------------------ MENU 3: ALQUILERES --------------------
settextstyle(2,0,6);
boton(0, 5, 250, 30, 7, 0, "1.- Altas de Alquiler", 16);
boton(0, 45, 250, 70, 7, 0, "2.- Modificar", 16);
boton(0, 85, 250, 110, 7, 0, "3.- Volver", 16);
break;
case 14:// ------------------- MENU 4: DEVOLUCIONES ------------------
settextstyle(2,0,6);
boton(0, 5, 250, 30, 7, 0, "1.- Devoluciones", 16);
boton(0, 45, 250, 70, 7, 0, "2.- Modificaciones", 16);
boton(0, 85, 250, 110, 7, 0, "3.- Volver", 16);
break;
} //fin del switch-case(estoy_en).
setlinestyle(3,0,2);
switch (select_actual)// Ahora pintamos un recuadro al bot<6F>n seleccionado.
{
case 1:
rectangle(5,9,245,26);
setlinestyle(0,0,2);rectangle(0,5,250,30);
break;
case 2:
rectangle(5,49,245,66);
setlinestyle(0,0,2);rectangle(0,45,250,70);
break;
case 3:
rectangle(5, 89, 245, 106);
setlinestyle(0,0,2);rectangle(0,85,250,110);
break;
case 4:
rectangle(5, 129, 245, 146);
setlinestyle(0,0,2);rectangle(0,125,250,150);
break;
case 5:
rectangle(5,169, 245, 186);
setlinestyle(0,0,2);rectangle(0,165,250,190);
break;
} // fin del switch-case(select_actual).
setlinestyle(0,0,0); // volvemos a poner el estilo de l<>nea normal.
} // fin de la funci<63>n men<65>.
// ------------------------------------------------------------------------
// FUNCI<43>N LOCALIZACI<43>N
// ------------------------------------------------------------------------
void localizacion(int estoy_en, int x, int y) {
settextstyle(2,0,5);
boton(5,100,getmaxx()-225,124,7,1,"Localizaci<EFBFBD>n:",8);
setcolor(1);
switch (estoy_en) {
case 1:
outtextxy(x,y,"Men<EFBFBD> General");
break;
case 11:
outtextxy(x,y, "Men<EFBFBD> General / Gesti<74>n de Clientes");
break;
case 12:
outtextxy(x,y, "Men<EFBFBD> General / Gesti<74>n de Pedidos");
break;
case 13:
outtextxy(x,y, "Men<EFBFBD> General / Alquileres");
break;
case 14:
outtextxy(x,y, "Men<EFBFBD> General / Devoluciones");
break;
} // fin del switch-case
} // fin de la funci<63>n.
// ------------------------------------------------------------------------
// FUNCI<43>N RELOJ
// ------------------------------------------------------------------------
void reloj (int x, int y) {
setviewport(0,0,getmaxx(),getmaxy(),1);
time_t t;
time(&t);
settextstyle(2,0,5);
boton (x,y,x+210,y+25,7,0,ctime(&t),1);
}

BIN
CPP/Video Club Alfa.zip Normal file

Binary file not shown.

149
CPP/WIN.CPP Normal file
View File

@ -0,0 +1,149 @@
#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include <dos.h>
#define seleccionado color_numero=color_menu=9;settextstyle(7,0,4);
#define no_seleccionado color_numero=3;color_menu=8;settextstyle(8,0,3);
void ventana(int x1, int y1, int x2, int y2, char titulo[80]);
void boton(int x1, int y1, int x2, int y2,int, char titulo[80]);
void main(){
int gdriver = DETECT, gmode, errorcode;
initgraph(&gdriver, &gmode, "d:\\tc\\bgi");
errorcode = graphresult();
if (errorcode != grOk){
printf("Error al iniciar el modo gr<67>fico: %s\n",
grapherrormsg(errorcode));
printf("Pulse cualquier tecla1 para finalizar...");
getch();
exit(1);
}
int midx, midy, i;
midx = getmaxx() / 2;
midy = getmaxy() / 2;
/* loop through the fill patterns */
// for (i=0; i<12; i++)
// {
/* set the fill style */
setfillstyle(1,1);bar(1,1,getmaxx(),getmaxy());
setcolor(8);
bar3d(midx-153, midy-148, midx+153, midy+153, 0, 1);
setcolor(7);
bar3d(midx-152, midy-147, midx+152, midy+152, 0, 1);
setcolor(16);
bar3d(midx-151, midy-146, midx+151, midy+151, 0, 1);
setfillstyle(1,9);
bar3d(midx-150, midy-145, midx+150, midy+150, 0, 1);
setfillstyle(1, 1);
bar3d(midx-150, midy-145, midx+150, midy-120, 0, 1);
settextstyle(2,0,5);
setcolor(15);outtextxy(midx-140,midy-140,"Ooohh.. It`s Fun !!");
getch();
setfillstyle(1,1);bar(1,1,getmaxx(),getmaxy());
ventana(midx-150,midy-150,midx+150,midy+150,"Microsoft Word _OX");
boton(midx-15,midy-15,midx+60,midy+10,0,"Acepta?");
// }
getch();
boton(midx-15,midy-15,midx+60,midy+10,1,"Acepta?");delay(305);
int o=1;
for ( o; o<200;o+=5){
ventana(midx-o,midy-o,midx+o,midy+o,"Se Sale...");
// setfillstyle(1,1);bar(midx-o,midy-o,midx+o,midy+o);
}
ventana(midx-o,midy-o,midx+o,midy+o,"Se Sale...");
getch();
/* int x1=midx-o+3, y1=midy-o+3, x2=midx+o-4, y2=midy-o+20;
bar(x1,y1,x2,y2);
for (int k=0; y1<getmaxy() && x2>(x1+10);k+=10){
bar(x1,y1+k,x2,y2+20);
} */
getch();
closegraph();
}
void ventana(int x1, int y1, int x2, int y2,char titulo[]){
// ventana normal -----------------------------------------------
setcolor(7); rectangle(x1,y1,x2,y2); // cuadro gris claro
setcolor(16);
line(x1,y2,x2,y2); // linea negra -- abajo
line(x2,y2,x2,y1); // linea negra | derecha
setcolor(15); rectangle(x1+1,y1+1,x2-1,y2-1); //cuadro blanco dentro
setcolor(8);
line(x1+1,y2-1,x2-1,y2-1); // gris -- abajo
line(x2-1,y1+1,x2-1,y2-1); // gris | derecha
setfillstyle(1,7);
bar(x1+2,y1+2,x2-2,y2-2);// interior gris de la ventana
setfillstyle(1,1);
bar(x1+3,y1+3,x2-4,y1+20);// fondo azul del titulo
setcolor(15);
outtextxy(x1+10,y1+4,titulo);
//--------------------------------------------------------------
}
// --------------------------------------------------------------------
// FUNCI<43>N BOTON
// --------------------------------------------------------------------
void boton(int x1,int y1, int x2,int y2,int pulsado,char titulo[]) {
setcolor(7); rectangle(x1,y1,x2,y2); // cuadro gris claro
if (pulsado)
{
setcolor(16);
line(x1, y1, x2, y1); // linea negra -- arriba
line(x1, y2, x1, y1); // linea negra | izquierda
setcolor(15);
rectangle(x1+1,y1+1,x2-1,y2-1); //cuadro blanco dentro
setcolor(8);
line(x1+1, y1+1, x2-1, y1+1); // gris -- arriba
line(x1+1, y1+1, x1+1, y2-1); // gris | izquierda
}
else {
setcolor(16);
line(x1, y2, x2, y2); // linea negra -- abajo
line(x2, y2, x2, y1); // linea negra | derecha
setcolor(15);
rectangle(x1+1, y1+1, x2-1, y2-1); //cuadro blanco dentro
setcolor(8);
line(x1+1, y2-1, x2-1, y2-1); // gris -- abajo
line(x2-1, y1+1, x2-1, y2-1); // gris | derecha
}
setfillstyle(1,7);
bar(x1+2, y1+2, x2-2, y2-2);// interior gris de la ventana
outtextxy(x1+10,y1+4,titulo);
} // FIN DE LA FUNCI<43>N ----------------------------------------------------

BIN
CPP/super/ACTPROVE.OBJ Normal file

Binary file not shown.

1461
CPP/super/VIDEOFI.CPP Normal file

File diff suppressed because it is too large Load Diff