Backup proyecto Joyfe - Borland
This commit is contained in:
422
CPP/PROG13.CPP
Normal file
422
CPP/PROG13.CPP
Normal 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);
|
||||
}
|
||||
Reference in New Issue
Block a user