SlideShare ist ein Scribd-Unternehmen logo
1 von 47
LAZARUS
LISTADO DE CÓDIGOS
ELMER YAIR MURCIA MURCIA
JONATHAN YESID VELANDIA FRAILE
Alumnos Tercer Semestre
TRABAJO ESCRITO PARA LA OBTENCIÓN DE LOGROS
CORRESPONDIENTES AL TERCER SEMESTRE ACADÉMICO
AGUSTÍN DE JESÚS VILLALOBOS FLORIÁN
Docente
FUNDACIÓN UNIVERSITARIA DE SAN GIL - UNISANGIL
INGENIERÍA DE SISTEMAS
BIOLOGÍA GENERAL
CHIQUINQUIRÁ
2013
__________________________________________________________
__________________________________________________________
program DatosPersonales;
uses crt;
Begin
clrscr;
gotoxy (30,8);
textcolor(6);
writeln ('Cedula: 1.053.342.968');
gotoxy (21,9);
textcolor(2);
writeln ('Nombre: Jonathan Yesid Velandia Fraile');
gotoxy (27,10);
textcolor(3);
writeln ('Direccion: Calle 5 N 9A-17');
gotoxy (30,11);
textcolor(4);
writeln ('Celular: 3133384177');
gotoxy (23,12);
textcolor(5);
writeln ('Profesion: Ingenieria de Sistemas');
gotoxy (45,14);
textcolor(9);
write ('//Pulse una letra para terminar//');
ReadKey;
end.
__________________________________________________________
__________________________________________________________
__________________________________________________________
__________________________________________________________
program MenuIf;
uses crt;
var
x,d:integer;
op:char;
a,b,c,y,m:real;
Begin
clrscr;
textcolor(2);
gotoxy (10,2);
write('MENU PRINCIPAL');
gotoxy (6,4);
write('1.Sumar Tres Numeros.');
gotoxy (6,5);
write('2.Raiz Cuadrada.');
gotoxy (6,6);
write('3.Valor Absoluto.');
gotoxy (6,7);
write('4.Ordenar dos numeros.');
gotoxy (6,8);
write('5.Salir.');
gotoxy (6,10);
write('Por favor digite su opcion: ');
read(x);
clrscr;
if x=1 then
begin
gotoxy (3,2);
write('Digite el primer numero que desee: ');
readln(a);
gotoxy (3,3);
write('Digite el segundo numero que desee: ');
readln(b);
gotoxy (3,4);
write('Digite el tercer numero que desee: ');
readln(c);
gotoxy (3,6);
textcolor(2);
write('La suma de los tres numeros ingresados es: ',a+b+c:0:1);
end;
if x=2 then
begin
gotoxy (3,2);
write('Digite el numero que desee: ');
readln(d);
m:=sqrt(d);
gotoxy (3,4);
textcolor(2);
write ('La raiz cuadrada del numero ingresado es: ',m:0:1);
end;
if x=3 then
begin
gotoxy (3,2);
write('Digite el numero que desee: ');
readln(y);
m:=abs(y);
gotoxy (3,4);
textcolor(2);
write ('El valor absoluto del numero ingresado es: ',m:0:0);
end;
if x=4 then
begin
gotoxy (3,2);
write('Digite el primer numero que desee: ');
readln(a);
gotoxy (3,3);
write('Digite el segundo numero que desee: ');
readln(b);
if a>b then
begin
gotoxy (3,5);
textcolor(2);
write('El numero mayor es: ',a:0:1,' y el menor es: ',b:0:1);
end;
if b>a then
begin
gotoxy (3,5);
textcolor(2);
write('El numero mayor es: ',b:0:1,' y el menor es: ',a:0:1);
end;
end;
if x=5 then
begin
gotoxy (3,2);
textcolor(2);
writeln('Por favor presione una tecla para finalizar. Gracias...');
end;
Readkey;
end.
__________________________________________________________
__________________________________________________________
__________________________________________________________
__________________________________________________________
program TallerMenuCase;
uses crt;
var
x,a,b,c,y,n,z,i:integer;
begin
clrscr;
textcolor(2);
gotoxy(3,2);
write('MENU...');
gotoxy(3,4);
write('1.Portada del trabajo');
gotoxy(3,5);
write('2.Ordenar tres numeros de forma ascendente.');
gotoxy(3,6);
write('3.Generar los primeros n numeros pares.');
gotoxy(3,7);
write('4.Leer un numero entre 1 y 7 para saber el dia al cual corresponde.');
gotoxy(3,8);
write('5.Despedida. Salida del programa.');
gotoxy(3,10);
write('Ingrese la opcion que desee: ');
read(x);
clrscr;
case x of
1:
begin
gotoxy(35,2);
write('TURBO PASCAL');
gotoxy(27,8);
write('JONATHAN YESID VELANDIA FRAILE');
gotoxy(27,6);
write('EDWIN FERNANDO BUITRAGO BELLO');
gotoxy(28,7);
write('HERNAN JAVIER TORRES BAQUERO');
gotoxy(38,9);
write('Alumnos:');
gotoxy(24,13);
write('AGUSTIN DE JESUS VILLALOBOS FLORIAN');
gotoxy(37,14);
write('Ingeniero:');
gotoxy(19,20);
write('FUNDACION UNIVERSITARIA DE SAN - GIL UNISANGIL');
gotoxy(32,21);
write('INGENIERIA DE SISTEMAS');
gotoxy(34,22);
write('ESTRUCTURA DE DATOS');
gotoxy(37,23);
write('CHIQUINQUIRA');
gotoxy(41,24);
write('2013');
end;
2:
begin
gotoxy(3,2);
write('Ingrese el primer numero: ');
readln(a);
gotoxy(3,3);
write('Ingrese el segundo numero: ');
readln(b);
gotoxy(3,4);
write('Ingrese el tercer numero: ');
readln(c);
gotoxy(3,6);
write('El orden de los numeros en forma ascendente es: ');
if ((a>b) and (b>c)) then
write(a,b,c);
if ((a>c) and (c>b)) then
write(a,c,b);
if ((b>a) and (a>c)) then
write(b,a,c);
if ((b>c) and (c>a)) then
write(b,c,a);
if ((c>a) and (a>b)) then
write(c,a,b);
if ((c>b) and (b>a)) then
write(c,b,a);
end;
3:
begin
gotoxy(3,2);
write('Ingrese el numero que desee: ');
read(n);
for i:=1 to n do
if i mod 2=0 then
writeln(' El numero par es: ',i)
end;
4:
begin
gotoxy(3,2);
write('Digite un numero entre 1 y 7 para conocer el dia al cual
corresponde: ');
read(y);
gotoxy(3,4);
if y=1 then
write('El dia correspondiente al numero 1 es: Lunes.');
if y=2 then
write('El dia correspondiente al numero 2 es: Martes.');
if y=3 then
write('El dia correspondiente al numero 3 es: Miercoles.');
if y=4 then
write('El dia correspondiente al numero 4 es: Jueves.');
if y=5 then
write('El dia correspondiente al numero 5 es: Viernes.');
if y=6 then
write('El dia correspondiente al numero 6 es: Sabado.');
if y=7 then
write('El dia correspondiente al numero 7 es: Domingo.');
if ((y>7)and(y<1)) then
begin
gotoxy(3,4);
writeln('La opcion ingresada no corresponde a las establecidas en el
menu.');
gotoxy(3,5);
write('El programa se cerrara. Por favor seleccione de nuevo otra (1 - 7).');
end;
end;
5:
begin
gotoxy(3,2);
writeln('Gracias por utilizar nuestro programa que tenga buen dia.');
gotoxy(3,3);
write('Por favor presione una tecla para salir!!!');
end;
else
gotoxy(3,2);
writeln('La opcion ingresada no corresponde a las establecidas en el
menu.');
gotoxy(3,3);
write('El programa se cerrara. Por favor seleccione de nuevo otra (1 - 5).');
end;
ReadKey;
end.
__________________________________________________________
__________________________________________________________
__________________________________________________________
__________________________________________________________
program Vectores;
uses crt;
var
v:array[1..11]of integer;
j,i:integer;
begin
textbackground(5);
textcolor(2);
clrscr;
writeln('Este programa permite almacenar 10 numeros y multiplicarlos por
5.');
writeln('____________________________________________________
_________');
writeln('| | | | | | | | | | |');
writeln('____________________________________________________
_________');
textcolor(yellow);
j:=-2;
for i:=1 to 10 do
begin
j:=j+6;
gotoxy(j,3);
read(v[i]);
end;
textcolor(7);
gotoxy(1,8);
writeln('____________________________________________________
_________');
gotoxy(1,9);
writeln('| | | | | | | | | | |');
gotoxy(1,10);
writeln('____________________________________________________
_________');
textcolor(yellow);
j:=-2;
for i:=1 to 10 do
begin
j:=j+6;
gotoxy(j,9);
write(v[i]*5);
end;
readkey;
end.
__________________________________________________________
__________________________________________________________
__________________________________________________________
__________________________________________________________
program VectorAscendente;
uses crt;
var
vec:array[1..14]of integer;
j,i,aux,n:integer;
begin
textbackground(4);
textcolor(2);
clrscr;
gotoxy(3,2);
writeln('PROGRAMA VECTORES: METODO BURBUJA.');
gotoxy(3,4);
writeln('Este programa permite almacenar 13 numeros y ordenarlos de forma
ascendente.');
gotoxy(3,6);
write('Cuantos datos desea almacenar: ');
read(n);
while (n<1) or (n>13) do
begin
gotoxy(3,8);
write('Rango del numero no permitido');
gotoxy(3,9);
write('Ingrese de nuevo el numero de datos a almacenar: ');
clreol;
read(n);
end;
clrscr;
j:=-2;
for i:=1 to n do
begin
j:=j+6;
gotoxy(j,2);
read(vec[i]);
end;
for i:=1 to n-1 do
begin
for j:=i+1 to n do
begin
if vec[i]>vec[j] then
begin
aux:=vec[i];
vec[i]:=vec[j];
vec[j]:=aux;
end;
end;
end;
j:=-2;
for i:=1 to n do
begin
j:=j+6;
gotoxy(j,4);
textcolor(yellow);
write(vec[i]);
end;
readkey;
end.
__________________________________________________________
__________________________________________________________
__________________________________________________________
__________________________________________________________
program VectorMetodoBurbuja;
uses crt;
var
vec:array[1..13]of integer;
j,i,aux,n:integer;
begin
textbackground(4);
textcolor(2);
clrscr;
gotoxy(3,2);
writeln('PROGRAMA VECTORES: METODO BURBUJA.');
gotoxy(3,4);
writeln('Este programa permite almacenar 13 numeros y ordenarlos de forma
ascendente.');
gotoxy(3,6);
write('Cuantos datos desea almacenar: ');
read(n);
textcolor(yellow);
j:=-2;
for i:=1 to n do
begin
j:=j+6;
gotoxy(j,8);
read(vec[i]);
end;
for i:=1 to n-1 do
begin
for j:=i+1 to n do
begin
if vec[i]>vec[j] then
begin
aux:=vec[i];
vec[i]:=vec[j];
vec[j]:=aux;
end;
end;
end;
j:=-2;
for i:=1 to n do
begin
j:=j+6;
gotoxy(j,10);
write(vec[i]);
end;
readkey;
end.
__________________________________________________________
__________________________________________________________
__________________________________________________________
__________________________________________________________
program MatrizGaussJordan;
uses crt;
var
mat:array[1..20,1..10]of real;
var
resmenu:char;
coef,aux:real;
i,j,v,n,m:integer;
fil,posf,col,posc,cant,opc:integer;
//Procedimiento: Portada.
procedure portada;
begin
textbackground(red);
textcolor (white);
clrscr;
gotoxy(20,2);
write('SOLUCION DE MATRICES - METODO GAUSS JORDAN');
gotoxy(25,6);
write('MAIRA JAMBLEIDY PORRAS GARZON');
gotoxy(25,7);
write('JONATHAN YESID VELANDIA FRAILE');
gotoxy(36,8);
write('Alumnos:');
gotoxy(22,13);
write('AGUSTIN DE JESUS VILLALOBOS FLORIAN');
gotoxy(35,14);
write('Ingeniero:');
gotoxy(17,20);
write('FUNDACION UNIVERSITARIA DE SAN GIL - UNISANGIL');
gotoxy(29,21);
write('INGENIERIA DE SISTEMAS');
gotoxy(30,22);
write('ESTRUCTURA DE DATOS');
gotoxy(34,23);
write('CHIQUINQUIRA');
gotoxy(38,24);
write('2013');
readkey;
end;
//Procedimiento: Introduccion.
procedure introduccion;
begin
gotoxy(20,2);
write('SOLUCION DE MATRICES - METODO GAUSS JORDAN');
gotoxy(4,5);
write('La solucion de sistemas de ecuaciones lineales encuentra una amplia');
gotoxy(4,6);
write('aplicacion en la CIENCIA y la TECNOLOGIA. Se puede afirmar, que
en');
gotoxy(4,7);
write('cualquier rama de la Ingenieria existe al menos una aplicacion la');
gotoxy(4,8);
write('cual requiera el planteamineto y solucion de tales sistemas.');
gotoxy(4,10);
write('Por ello profundizamos en el tema y realizamos el presente
programa');
gotoxy(4,11);
write('para facilitar su solucion y corrobar respuestas obtenidas cuando
se');
gotoxy(4,12);
write('hace de forma manual.');
gotoxy(44,24);
textcolor(2);
write('Presione una tecla para continuar...');
readkey;
end;
//Procedimiento: Definicion.
procedure definicion;
begin
gotoxy(20,2);
write('SOLUCION DE MATRICES - METODO GAUSS JORDAN');
gotoxy(4,5);
write('Sistema de ecuaciones lineales de m ecuaciones con n incognitas.');
gotoxy(4,7);
write('a11 a12 ... a1n b1');
gotoxy(4,8);
write('a21 a22 ... a2n b2');
gotoxy(5,9);
write('. . . .');
gotoxy(5,10);
write('. . . .');
gotoxy(5,11);
write('. . . .');
gotoxy(4,12);
write('am1 am2 ... amn bm');
gotoxy(4,14);
write('Este metodo permite determinar la solucion de un sistema de
ecuaciones');
gotoxy(4,15);
write('lineales, encontrar matrices y su inversa; reducciendo el sistema
dado');
gotoxy(4,16);
write('a otro equivalente en el cual cada ecuacion tiene una incognita
menos');
gotoxy(4,17);
write('que la anterior. Sus creadores fueron:');
gotoxy(3,19);
write('- Carl Friedrinch Gauss.');
gotoxy(3,20);
write('- Wilhelm Jordan.');
gotoxy(44,24);
textcolor(2);
write('Presione una tecla para continuar...');
readkey;
end;
//Procedimiento: Registro de variables.
procedure variables;
begin
gotoxy(3,2);
write('Rango de variables: 2 a 10.');
gotoxy(3,4);
write('Digite el numero de variables: ');
read(v);
while (v<2) or (v>10) do
begin
gotoxy(3,6);
write('Rango de variables no valido...');
gotoxy(3,7);
write('Digite de nuevo el numero de variables: ');
clreol;
readln(v);
end;
fil:=v;
col:=v+1;
clrscr;
end;
//Procedimiento: Marco de la matriz.
procedure marco;
begin
for i:=1 to fil+1 do
begin
posc:=2+col*6;
gotoxy(2,i*2);
for j:=2 to posc do
write('-');
end;
cant:=2+2*fil;
for i:=1 to col+1 do
begin
posc:=-4+i*6;
gotoxy(posc,2);
for j:=2 to cant do
begin
gotoxy(posc,j);
write('|');
end;
end;
end;
//Procedimiento: Captura de datos.
procedure captura;
begin
for i:=1 to fil do
begin
posf:=1+(i*2);
for j:=1 to col do
begin
posc:=(j*6)-3;
gotoxy(posc,posf);
read(mat[i,j]);
end;
end;
end;
//Procedimiento: Solucion de la matriz.
procedure gauss1;
begin
for i:=1 to fil do
begin
coef:=mat[i,i];
for j:=1 to col do
begin
mat[i,j]:=mat[i,j]/coef;
end;
if i=1 then
begin
for m:=2 to fil do
begin
aux:=mat[m,i];
for n:=1 to col do
begin
mat[m,n]:=((-1)*(aux)*mat[i,n]+mat[m,n]);
end;
end;
end;
if i>1 then
begin
for m:=1 to i-1 do
begin
aux:=mat[m,i];
for n:=1 to col do
begin
mat[m,n]:=((-1)*(aux)*mat[i,n]+mat[m,n]);
end;
end;
for m:=i+1 to fil do
begin
aux:=mat[m,i];
for n:=1 to col do
begin
mat[m,n]:=((-1)*(aux)*mat[i,n]+mat[m,n]);
end;
end;
end;
end;
end;
//Procedimiento: Resultados.
procedure resultados;
begin
for i:=1 to fil do
begin
posf:=1+(i*2);
for j:=1 to col do
begin
posc:=(j*6)-3;
gotoxy(posc,posf);
write(mat[i,j]:0:1);
end;
end;
end;
//Procedimiento:Fin Resultados.
procedure fin;
begin
gotoxy(3,2);
write('Que tenga un excelente dia.');
gotoxy(3,3);
write('Gracias por utilizar nuestro programa.');
gotoxy(43,24);
textcolor(2);
write('Presione una tecla para continuar...');
readkey;
end;
//Procedimiento: Salida.
procedure salir;
begin
gotoxy(3,2);
write('Que tenga un excelente dia.');
gotoxy(3,3);
write('Gracias por utilizar nuestro programa.');
gotoxy(43,24);
textcolor(2);
write('Presione una tecla para continuar...');
readkey;
end;
//Programa Principal..
begin
portada;
clrscr;
resmenu:='s';
while (resmenu='s') or (resmenu='S') do
begin
clrscr;
begin
gotoxy(20,2);
write('SOLUCION DE MATRICES - METODO GAUSS JORDAN');
gotoxy(14,5);
write('1. Introduccion.');
gotoxy(14,6);
write('2. Definicion.');
gotoxy(14,7);
write('3. Solucion de ejercicios.');
gotoxy(14,8);
write('4. Salir.');
gotoxy(14,10);
write('Digite la opcion que desea: ');
readln(opc);
while (opc<1) or (opc>4) do
begin
gotoxy(14,12);
write('Opcion incorrecta...');
gotoxy(14,13);
write('Digite de nuevo su opcion: ');
clreol;
readln(opc);
end;
clrscr;
case opc of
1:
begin
introduccion;
end;
2:
begin
definicion;
end;
3:
begin
variables;
clrscr;
marco;
captura;
gauss1;
resultados;
readkey;
clrscr;
fin;
end;
4:
begin
salir;
exit;
end;
end;
end;
clrscr;
textcolor(white);
gotoxy(3,2);
write('Desea volver al menu???');
gotoxy(3,3);
write('s/n: ');
readln(resmenu);
clrscr;
if resmenu='n' then
begin
gotoxy(3,2);
write('Que tenga un excelente dia.');
gotoxy(3,3);
write('Gracias por utilizar nuestro programa.');
gotoxy(43,24);
textcolor(2);
write('Presione una tecla para continuar...');
readkey;
end;
end;
end.
__________________________________________________________
__________________________________________________________
__________________________________________________________
__________________________________________________________
program Registros;
uses crt;
type
tregusuario=record
idusuario:string [10];
nomusuario:string [30];
edadusuario:integer;
end;
type
tregpagos=record
idusuariopago:string[10];
valorusuario:real;
fechausuario:string[10];
end;
var
usuarios:array[1..50] of tregusuario;
pagos:array[1..100] of tregpagos;
res,resp,resmenu:char;
i,j,k:integer;
n,m:integer;
opc:integer;
procedure menu;
begin
textcolor(2);
gotoxy(3,2);
write('MENU...');
gotoxy(3,4);
write('1. Ingresar usuarios.');
gotoxy(3,5);
write('2. Mostrar usuarios.');
gotoxy(3,6);
write('3. Ingresar pagos.');
gotoxy(3,7);
write('4. Mostrar pagos.');
gotoxy(3,8);
write('5. Salir.');
gotoxy(3,10);
write('Por favor digite la opcion que desee: ');
readln(opc);
clrscr;
end;
procedure capturausuarios;
begin
textcolor(2);
i:=0;
res:='s';
while (res='s') or (res='S') do
begin
clrscr;
i:=i+1;
gotoxy (3,2);
write('Usuario ',i,':');
gotoxy (3,4);
write('Digite identificacion del usuario: ');
readln(usuarios[i].idusuario);
gotoxy (3,5);
write('Digite nombre del usuario : ');
readln(usuarios[i].nomusuario);
gotoxy (3,6);
write('Digite edad del usuario : ');
readln(usuarios[i].edadusuario);
clrscr;
gotoxy (3,2);
write('Desea ingresar mas usuarios???');
gotoxy (3,3);
write('s/n: ');
readln(res);
end;
end;
procedure mostrarusuarios;
begin
for n:=1 to i do
begin
gotoxy (3,2);
write('Identificacion');
gotoxy (3,3+n);
write(usuarios[n].idusuario);
gotoxy (25,2);
write('Nombre');
gotoxy (25,3+n);
write(usuarios[n].nomusuario);
gotoxy (45,2);
write('Edad');
gotoxy (45,3+n);
write(usuarios[n].edadusuario);
end;
end;
procedure capturapagos;
begin
j:=0;
resp:='s';
while (resp='s') or (resp='S') do
begin
clrscr;
j:=j+1;
gotoxy (3,2);
write('Usuario ',j,':');
gotoxy (3,4);
write('Digite identificacion del usuario: ');
readln(pagos[j].idusuariopago);
gotoxy (3,5);
write('Digite el pago del usuario : ');
readln(pagos[j].valorusuario);
gotoxy (3,6);
write('Digite la fecha del pago : ');
readln(pagos[j].fechausuario);
clrscr;
gotoxy (3,2);
write('Desea ingresar mas pagos???');
gotoxy (3,3);
write('s/n: ');
readln(resp);
end;
end;
procedure mostrarpagos;
begin
begin
for m:=1 to j do
begin
gotoxy (3,2);
write('Identificacion');
gotoxy (3,3+m);
write(pagos[m].idusuariopago);
gotoxy (25,2);
write('Valor del pago');
gotoxy (25,3+m);
write('$ ',pagos[m].valorusuario:0:3);
gotoxy (45,2);
write('Fecha');
gotoxy (45,3+m);
write(pagos[m].fechausuario);
end;
end;
end;
begin
resmenu:='s';
while (resmenu='s') or (resmenu='S') do
begin
clrscr;
k:=k+1;
begin
menu;
clrscr;
case opc of
1:
begin
capturausuarios;
end;
2:
begin
mostrarusuarios;
end;
3:
begin
capturapagos;
end;
4:
begin
mostrarpagos;
end;
5:
begin
gotoxy(3,2);
write('Que tenga un buen dia.');
readkey;
exit;
end;
end;
readkey;
clrscr;
gotoxy(3,2);
write('Desea volver al menu???');
gotoxy(3,3);
write('s/n: ');
readln(resmenu);
end;
end;
end.
__________________________________________________________
__________________________________________________________
__________________________________________________________
__________________________________________________________
program ARCHIVOS;
uses crt;
type
tregusuario=record
idusuario:string [10];
nomusuario:string [30];
edadusuario:integer;
end;
type
tregpagos=record
idusuariopago:string[10];
valorusuario:real;
fechausuario:string[10];
end;
type
tarcusuarios = file of tregusuario;
tarcpagos = file of tregpagos;
var
usuarios:tarcusuarios;
pagos:tarcpagos;
regusuarios:tregusuario;
regpagos:tregpagos;
c,d,i,j,opc,posc,posd,fi,enc:integer;
res,resmenu:char;
id:string[12];
con,eliminar:string[20];
procedure eliminardatos;
begin
textbackground(red);
textcolor(white);
gotoxy(3,2);
write('Por favor digite su contrasena: ');
textcolor(red);
readln(con);
textcolor(white);
while (con<>'jonathanvelandia') do
begin
gotoxy(3,4);
write('Contrasena ingresada incorrecta.');
gotoxy(3,5);
write('Por favor digite de nuevo su contrasena: ');
textcolor(red);
readln(con);
clreol;
textcolor(white);
end;
clrscr;
if (con='jonathanvelandia') then
begin
gotoxy(3,2);
writeln('Datos a eliminar, USUARIOS o PAGOS: ');
gotoxy(3,4);
readln(eliminar);
if (eliminar='usuarios') or (eliminar='USUARIOS') then
begin
gotoxy (3,6);
write('ESTA SEGURO QUE DESEA ELIMINAR SU
INFORMACION???');
gotoxy(3,7);
write('Para confirmar pulse "S" de lo contrario "N": ');
readln(eliminar);
if (eliminar='s') or (eliminar='S') then
begin
rewrite(usuarios);
gotoxy (3,9);
write('Tu lista de usuarios a sido eliminada.')
end;
end;
if (eliminar='pagos') or (eliminar='PAGOS') then
begin
gotoxy(3,6);
write('ESTA SEGURO QUE DESEA ELIMINAR SU
INFORMACION???');
gotoxy(3,7);
write('Para confirmar pulse "S" de lo contrario "N": ');
readln(eliminar);
if (eliminar='s') or (eliminar='S') then
begin
rewrite(pagos);
gotoxy (3,9);
write('Tu lista de pagos a sido eliminada.')
end;
end;
end;
end;
procedure capturausuarios;
begin
res:='s';
while (res='s') or (res='S') do
begin
clrscr;
c:=filesize(usuarios);
seek(usuarios,c);
gotoxy (3,2);
write('Usuario ',c,':');
gotoxy (3,4);
write('Digite identificacion del usuario: ');
readln(regusuarios.idusuario);
gotoxy (3,5);
write('Digite nombre del usuario : ');
readln(regusuarios.nomusuario);
gotoxy (3,6);
write('Digite edad del usuario : ');
readln(regusuarios.edadusuario);
write(usuarios,regusuarios);
clrscr;
gotoxy (3,2);
write('Desea ingresar mas usuarios???');
gotoxy (3,3);
write('s/n: ');
readln(res);
end;
end;
procedure mostrarusuarios;
begin
fi:=4;
posc:=0;
c:=filesize(usuarios);
for i:=1 to c do
begin
seek(usuarios,posc);
read(usuarios,regusuarios);
gotoxy (3,2);
write('Identificacion');
gotoxy (3,fi);
write(regusuarios.idusuario);
gotoxy (25,2);
write('Nombre');
gotoxy (25,fi);
write(regusuarios.nomusuario);
gotoxy (45,2);
write('Edad');
gotoxy (45,fi);
write(regusuarios.edadusuario);
posc:=posc+1;
fi:=fi+1;
if (i mod 15=0) then
begin
gotoxy(44,24);
textcolor(2);
write('Presione una tecla para continuar...');
readln;
clrscr;
fi:=4;
gotoxy(44,24);
textcolor(2);
write('Presione una tecla para continuar...');
textcolor(white);
end;
end;
end;
procedure buscarusuarios;
begin
gotoxy(3,2);
write('Digite la identificacion del usuario a buscar: ');
readln(id);
i:=0;
enc:=0;
c:=filesize(usuarios);
while (not EOF(usuarios)) do
begin
seek(usuarios,i);
read(usuarios,regusuarios);
if (regusuarios.idusuario=id) then
begin
gotoxy(3,4);
write('Usuario encontrado.');
gotoxy(3,6);
write('Nombre: ', regusuarios.nomusuario);
gotoxy(3,7);
write('Edad: ', regusuarios.edadusuario);
enc:=1;
end;
i:=i+1;
end;
if (enc=0) then
begin
gotoxy(3,4);
write('Usuario no encontrado.');
enc:=1;
end;
end;
procedure capturapagos;
begin
gotoxy(3,2);
write('Digite identificacion del usuario para registrar el pago: ');
readln(regpagos.idusuariopago);
j:=0;
enc:=0;
d:=filesize(pagos);
while (not EOF(usuarios)) do
begin
seek(pagos,d);
read(usuarios,regusuarios);
if (regusuarios.idusuario=regpagos.idusuariopago) then
begin
gotoxy(3,4);
write('Usuario encontrado.');
gotoxy(3,5);
write('Nombre: ', regusuarios.nomusuario);
gotoxy(3,6);
write('Edad : ', regusuarios.edadusuario);
gotoxy(3,8);
write('Digite el pago del usuario: ');
readln(regpagos.valorusuario);
gotoxy (3,9);
write('Digite la fecha del pago : ');
readln(regpagos.fechausuario);
write(pagos,regpagos);
enc:=1;
end;
j:=j+1;
end;
if (enc=0) then
begin
gotoxy(3,4);
write('Usuario no encontrado.');
enc:=1;
end;
end;
procedure mostrarpagos;
begin
fi:=4;
posd:=0;
d:=filesize(pagos);
for j:=1 to d do
begin
seek(pagos,posd);
read(pagos,regpagos);
gotoxy (3,2);
write('Identificacion');
gotoxy (3,fi);
write(regpagos.idusuariopago);
gotoxy (25,2);
write('Valor del pago');
gotoxy (25,fi);
write('$ ',regpagos.valorusuario:0:3);
gotoxy (45,2);
textcolor(white);
write('Fecha');
gotoxy (45,fi);
write(regpagos.fechausuario);
posd:=posd+1;
fi:=fi+1;
if (j mod 15=0) then
begin
gotoxy(44,24);
textcolor(2);
write('Presione una tecla para continuar...');
readln;
clrscr;
fi:=4;
gotoxy(44,24);
textcolor(2);
write('Presione una tecla para continuar...');
textcolor(white);
end;
end;
end;
procedure buscarpagos;
begin
gotoxy(3,2);
write('Digite la identificacion del usuario: ');
readln(id);
j:=0;
enc:=0;
d:=filesize(pagos);
while (not EOF(pagos)) do
begin
seek(pagos,j);
read(pagos,regpagos);
if (regpagos.idusuariopago=id) then
begin
gotoxy(3,4);
write('Pago del usuario encontrado.');
gotoxy(3,6);
write('Valor del pago: ', regpagos.valorusuario:0:3);
gotoxy(3,7);
write('Fecha: ', regpagos.fechausuario);
enc:=1;
end;
j:=j+1;
end;
if (enc=0) then
begin
gotoxy(3,4);
write('Pago del usuario no encontrado.');
enc:=1;
end;
end;
begin
textbackground(red);
resmenu:='s';
while (resmenu='s') or (resmenu='S') do
begin
clrscr;
begin
textcolor(white);
clrscr;
gotoxy(3,2);
write('MENU...');
gotoxy(3,4);
write('1. Ingresar usuarios.');
gotoxy(3,5);
write('2. Mostrar usuarios.');
gotoxy(3,6);
write('3. Ingresar pagos.');
gotoxy(3,7);
write('4. Mostrar pagos.');
gotoxy(3,8);
write('5. Buscar datos de usuarios.');
gotoxy(3,9);
write('6. Buscar datos de pagos.');
gotoxy(3,10);
write('7. Eliminacion de datos.');
gotoxy(3,11);
write('8. Salir.');
gotoxy(3,13);
write('Por favor digite la opcion que desee: ');
readln(opc);
while (opc<1) or (opc>8) do
begin
gotoxy(3,15);
write('La opcion ingresada no es la correcta.');
gotoxy(3,16);
write('Por favor digite de nuevo su opcion: ');
clreol;
readln(opc);
end;
clrscr;
assign(usuarios,'C:UsersSELLNETDesktopESTRUCTURA DE
DATOSLAZARUSARCHIVOSARCHIVO 01usuarios.dat');
assign(pagos,'C:UsersSELLNETDesktopESTRUCTURA DE
DATOSLAZARUSARCHIVOSARCHIVO 01pagos.dat');
reset(usuarios);
reset(pagos);
case opc of
1:
begin
capturausuarios;
end;
2:
begin
mostrarusuarios;
end;
3:
begin
capturapagos;
end;
4:
begin
mostrarpagos;
end;
5:
begin
buscarusuarios;
end;
6:
begin
buscarpagos;
end;
7:
begin
eliminardatos;
end;
8:
begin
gotoxy(3,2);
write('Que tenga un buen dia!!!');
gotoxy(3,3);
write('Presione una tecla para finalizar...');
readkey;
exit;
end;
end;
close(usuarios);
close(pagos);
end;
readkey;
clrscr;
gotoxy(3,2);
write('Desea volver al menu???');
gotoxy(3,3);
write('s/n: ');
readln(resmenu);
clrscr;
if resmenu='n' then
begin
gotoxy(3,2);
write('Que tenga un buen dia.');
gotoxy(3,3);
write('Presione una tecla para finalizar...');
readkey;
end;
end;
end.
__________________________________________________________
__________________________________________________________
__________________________________________________________
__________________________________________________________
program Punteros;
uses crt;
var
x,y,z:^integer;
a,b,c:^char;
d,e:char;
begin
clrscr;
gotoxy(30,2);
write('USO DE PUNTEROS');
new(a);
gotoxy(3,4);
write('Ingrese el dato que desea: ');
read(a^);
d:=pred(a^);
e:=pred(d);
gotoxy(3,6);
writeln(d,' ',e);
new(x);
x^:=80;
new(y);
y^:=-30;
new(z);
z^:=25;
gotoxy(3,8);
x^:=y^;
write(x^,' ',y^);
if y^=z^ then
begin
writeln('SI');
end
else
writeln('NO');
readkey;
end.
__________________________________________________________
__________________________________________________________
__________________________________________________________
__________________________________________________________
program PilasPunteros;
uses crt;
type
enlace=^regnodo;
regnodo=record
dato:integer;
siguiente:enlace;
end;
var
x,y:enlace;
i,j,Spares,pares,impares:integer;
begin
textcolor(2);
new(x);
x^.siguiente:=nil;
gotoxy(30,2);
write('CREACION DE UNA PILA');
gotoxy(27,3);
write('"Con un negativo finaliza"');
gotoxy(3,5);
write('Ingrese un numero: ');
readln(i);
Spares:=0;
pares:=0;
impares:=0;
Spares:=Spares+1;
if i mod 2=0 then
pares:=pares+1;
if i mod 2<>0 then
impares:=impares+1;
while i>=0 do
begin
new(y);
y^.dato:=i;
y^.siguiente:=x;
x:=y;
write('Ingrese un numero: ');
readln(i);
if i>=0 then
begin
Spares:=Spares+1;
if i mod 2=0 then
pares:=pares+1;
if i mod 2<>0 then
impares:=impares+1;
end;
end;
clrscr;
while y^.siguiente<>nil do
begin
writeln(y^.dato);
x:=y^.siguiente;
dispose(y);
y:=x;
end;
writeln('Los numeros ingresados fueron: ',Spares);
writeln('Los numeros pares ingresados fueron: ',pares);
writeln('Los numeros impares ingresados fueron: ',impares);
readkey;
dispose(x);
end.
__________________________________________________________
__________________________________________________________

Weitere ähnliche Inhalte

Mehr von UNISANGIL - Chiquinquirá (18)

Sistemas de numeración (conversiones)
Sistemas de numeración (conversiones)Sistemas de numeración (conversiones)
Sistemas de numeración (conversiones)
 
Conversiones
ConversionesConversiones
Conversiones
 
DATOS PERSONALES
DATOS PERSONALESDATOS PERSONALES
DATOS PERSONALES
 
MATRIZ MÉTODO GAUSS JORDAN
MATRIZ MÉTODO GAUSS JORDANMATRIZ MÉTODO GAUSS JORDAN
MATRIZ MÉTODO GAUSS JORDAN
 
Program menu if
Program menu ifProgram menu if
Program menu if
 
PILAS Y PUNTEROS
PILAS Y PUNTEROSPILAS Y PUNTEROS
PILAS Y PUNTEROS
 
PUNTEROS
PUNTEROSPUNTEROS
PUNTEROS
 
REGISTROS
REGISTROSREGISTROS
REGISTROS
 
MENÚ CASE
MENÚ CASEMENÚ CASE
MENÚ CASE
 
VECTOR ASCENDENTE
VECTOR ASCENDENTEVECTOR ASCENDENTE
VECTOR ASCENDENTE
 
VECTORES
VECTORESVECTORES
VECTORES
 
ARCHIVOS
ARCHIVOSARCHIVOS
ARCHIVOS
 
PILAS
PILASPILAS
PILAS
 
GRAFOS
GRAFOSGRAFOS
GRAFOS
 
LISTAS
LISTASLISTAS
LISTAS
 
COLAS
COLASCOLAS
COLAS
 
ARCHIVOS Y REGISTROS
ARCHIVOS Y REGISTROSARCHIVOS Y REGISTROS
ARCHIVOS Y REGISTROS
 
ARBOLES BINARIOS
ARBOLES BINARIOSARBOLES BINARIOS
ARBOLES BINARIOS
 

Kürzlich hochgeladen

Modulo-Mini Cargador.................pdf
Modulo-Mini Cargador.................pdfModulo-Mini Cargador.................pdf
Modulo-Mini Cargador.................pdf
AnnimoUno1
 

Kürzlich hochgeladen (11)

PROYECTO FINAL. Tutorial para publicar en SlideShare.pptx
PROYECTO FINAL. Tutorial para publicar en SlideShare.pptxPROYECTO FINAL. Tutorial para publicar en SlideShare.pptx
PROYECTO FINAL. Tutorial para publicar en SlideShare.pptx
 
EVOLUCION DE LA TECNOLOGIA Y SUS ASPECTOSpptx
EVOLUCION DE LA TECNOLOGIA Y SUS ASPECTOSpptxEVOLUCION DE LA TECNOLOGIA Y SUS ASPECTOSpptx
EVOLUCION DE LA TECNOLOGIA Y SUS ASPECTOSpptx
 
Resistencia extrema al cobre por un consorcio bacteriano conformado por Sulfo...
Resistencia extrema al cobre por un consorcio bacteriano conformado por Sulfo...Resistencia extrema al cobre por un consorcio bacteriano conformado por Sulfo...
Resistencia extrema al cobre por un consorcio bacteriano conformado por Sulfo...
 
Avances tecnológicos del siglo XXI y ejemplos de estos
Avances tecnológicos del siglo XXI y ejemplos de estosAvances tecnológicos del siglo XXI y ejemplos de estos
Avances tecnológicos del siglo XXI y ejemplos de estos
 
Avances tecnológicos del siglo XXI 10-07 eyvana
Avances tecnológicos del siglo XXI 10-07 eyvanaAvances tecnológicos del siglo XXI 10-07 eyvana
Avances tecnológicos del siglo XXI 10-07 eyvana
 
pruebas unitarias unitarias en java con JUNIT
pruebas unitarias unitarias en java con JUNITpruebas unitarias unitarias en java con JUNIT
pruebas unitarias unitarias en java con JUNIT
 
Modulo-Mini Cargador.................pdf
Modulo-Mini Cargador.................pdfModulo-Mini Cargador.................pdf
Modulo-Mini Cargador.................pdf
 
Refrigerador_Inverter_Samsung_Curso_y_Manual_de_Servicio_Español.pdf
Refrigerador_Inverter_Samsung_Curso_y_Manual_de_Servicio_Español.pdfRefrigerador_Inverter_Samsung_Curso_y_Manual_de_Servicio_Español.pdf
Refrigerador_Inverter_Samsung_Curso_y_Manual_de_Servicio_Español.pdf
 
How to use Redis with MuleSoft. A quick start presentation.
How to use Redis with MuleSoft. A quick start presentation.How to use Redis with MuleSoft. A quick start presentation.
How to use Redis with MuleSoft. A quick start presentation.
 
Innovaciones tecnologicas en el siglo 21
Innovaciones tecnologicas en el siglo 21Innovaciones tecnologicas en el siglo 21
Innovaciones tecnologicas en el siglo 21
 
EL CICLO PRÁCTICO DE UN MOTOR DE CUATRO TIEMPOS.pptx
EL CICLO PRÁCTICO DE UN MOTOR DE CUATRO TIEMPOS.pptxEL CICLO PRÁCTICO DE UN MOTOR DE CUATRO TIEMPOS.pptx
EL CICLO PRÁCTICO DE UN MOTOR DE CUATRO TIEMPOS.pptx
 

LISTADO CÓDIGOS (LAZARUS).

  • 1. LAZARUS LISTADO DE CÓDIGOS ELMER YAIR MURCIA MURCIA JONATHAN YESID VELANDIA FRAILE Alumnos Tercer Semestre TRABAJO ESCRITO PARA LA OBTENCIÓN DE LOGROS CORRESPONDIENTES AL TERCER SEMESTRE ACADÉMICO AGUSTÍN DE JESÚS VILLALOBOS FLORIÁN Docente FUNDACIÓN UNIVERSITARIA DE SAN GIL - UNISANGIL INGENIERÍA DE SISTEMAS BIOLOGÍA GENERAL CHIQUINQUIRÁ 2013
  • 2. __________________________________________________________ __________________________________________________________ program DatosPersonales; uses crt; Begin clrscr; gotoxy (30,8); textcolor(6); writeln ('Cedula: 1.053.342.968'); gotoxy (21,9); textcolor(2); writeln ('Nombre: Jonathan Yesid Velandia Fraile'); gotoxy (27,10); textcolor(3); writeln ('Direccion: Calle 5 N 9A-17'); gotoxy (30,11); textcolor(4); writeln ('Celular: 3133384177'); gotoxy (23,12); textcolor(5); writeln ('Profesion: Ingenieria de Sistemas'); gotoxy (45,14); textcolor(9); write ('//Pulse una letra para terminar//'); ReadKey; end. __________________________________________________________ __________________________________________________________
  • 3. __________________________________________________________ __________________________________________________________ program MenuIf; uses crt; var x,d:integer; op:char; a,b,c,y,m:real; Begin clrscr; textcolor(2); gotoxy (10,2); write('MENU PRINCIPAL'); gotoxy (6,4); write('1.Sumar Tres Numeros.'); gotoxy (6,5); write('2.Raiz Cuadrada.'); gotoxy (6,6); write('3.Valor Absoluto.'); gotoxy (6,7); write('4.Ordenar dos numeros.'); gotoxy (6,8); write('5.Salir.'); gotoxy (6,10); write('Por favor digite su opcion: '); read(x); clrscr; if x=1 then begin gotoxy (3,2); write('Digite el primer numero que desee: '); readln(a); gotoxy (3,3); write('Digite el segundo numero que desee: ');
  • 4. readln(b); gotoxy (3,4); write('Digite el tercer numero que desee: '); readln(c); gotoxy (3,6); textcolor(2); write('La suma de los tres numeros ingresados es: ',a+b+c:0:1); end; if x=2 then begin gotoxy (3,2); write('Digite el numero que desee: '); readln(d); m:=sqrt(d); gotoxy (3,4); textcolor(2); write ('La raiz cuadrada del numero ingresado es: ',m:0:1); end; if x=3 then begin gotoxy (3,2); write('Digite el numero que desee: '); readln(y); m:=abs(y); gotoxy (3,4); textcolor(2); write ('El valor absoluto del numero ingresado es: ',m:0:0); end; if x=4 then begin gotoxy (3,2); write('Digite el primer numero que desee: '); readln(a); gotoxy (3,3); write('Digite el segundo numero que desee: ');
  • 5. readln(b); if a>b then begin gotoxy (3,5); textcolor(2); write('El numero mayor es: ',a:0:1,' y el menor es: ',b:0:1); end; if b>a then begin gotoxy (3,5); textcolor(2); write('El numero mayor es: ',b:0:1,' y el menor es: ',a:0:1); end; end; if x=5 then begin gotoxy (3,2); textcolor(2); writeln('Por favor presione una tecla para finalizar. Gracias...'); end; Readkey; end. __________________________________________________________ __________________________________________________________
  • 6. __________________________________________________________ __________________________________________________________ program TallerMenuCase; uses crt; var x,a,b,c,y,n,z,i:integer; begin clrscr; textcolor(2); gotoxy(3,2); write('MENU...'); gotoxy(3,4); write('1.Portada del trabajo'); gotoxy(3,5); write('2.Ordenar tres numeros de forma ascendente.'); gotoxy(3,6); write('3.Generar los primeros n numeros pares.'); gotoxy(3,7); write('4.Leer un numero entre 1 y 7 para saber el dia al cual corresponde.'); gotoxy(3,8); write('5.Despedida. Salida del programa.'); gotoxy(3,10); write('Ingrese la opcion que desee: '); read(x); clrscr; case x of 1: begin gotoxy(35,2); write('TURBO PASCAL'); gotoxy(27,8); write('JONATHAN YESID VELANDIA FRAILE'); gotoxy(27,6); write('EDWIN FERNANDO BUITRAGO BELLO');
  • 7. gotoxy(28,7); write('HERNAN JAVIER TORRES BAQUERO'); gotoxy(38,9); write('Alumnos:'); gotoxy(24,13); write('AGUSTIN DE JESUS VILLALOBOS FLORIAN'); gotoxy(37,14); write('Ingeniero:'); gotoxy(19,20); write('FUNDACION UNIVERSITARIA DE SAN - GIL UNISANGIL'); gotoxy(32,21); write('INGENIERIA DE SISTEMAS'); gotoxy(34,22); write('ESTRUCTURA DE DATOS'); gotoxy(37,23); write('CHIQUINQUIRA'); gotoxy(41,24); write('2013'); end; 2: begin gotoxy(3,2); write('Ingrese el primer numero: '); readln(a); gotoxy(3,3); write('Ingrese el segundo numero: '); readln(b); gotoxy(3,4); write('Ingrese el tercer numero: '); readln(c); gotoxy(3,6); write('El orden de los numeros en forma ascendente es: '); if ((a>b) and (b>c)) then write(a,b,c); if ((a>c) and (c>b)) then write(a,c,b); if ((b>a) and (a>c)) then
  • 8. write(b,a,c); if ((b>c) and (c>a)) then write(b,c,a); if ((c>a) and (a>b)) then write(c,a,b); if ((c>b) and (b>a)) then write(c,b,a); end; 3: begin gotoxy(3,2); write('Ingrese el numero que desee: '); read(n); for i:=1 to n do if i mod 2=0 then writeln(' El numero par es: ',i) end; 4: begin gotoxy(3,2); write('Digite un numero entre 1 y 7 para conocer el dia al cual corresponde: '); read(y); gotoxy(3,4); if y=1 then write('El dia correspondiente al numero 1 es: Lunes.'); if y=2 then write('El dia correspondiente al numero 2 es: Martes.'); if y=3 then write('El dia correspondiente al numero 3 es: Miercoles.'); if y=4 then write('El dia correspondiente al numero 4 es: Jueves.'); if y=5 then write('El dia correspondiente al numero 5 es: Viernes.'); if y=6 then write('El dia correspondiente al numero 6 es: Sabado.');
  • 9. if y=7 then write('El dia correspondiente al numero 7 es: Domingo.'); if ((y>7)and(y<1)) then begin gotoxy(3,4); writeln('La opcion ingresada no corresponde a las establecidas en el menu.'); gotoxy(3,5); write('El programa se cerrara. Por favor seleccione de nuevo otra (1 - 7).'); end; end; 5: begin gotoxy(3,2); writeln('Gracias por utilizar nuestro programa que tenga buen dia.'); gotoxy(3,3); write('Por favor presione una tecla para salir!!!'); end; else gotoxy(3,2); writeln('La opcion ingresada no corresponde a las establecidas en el menu.'); gotoxy(3,3); write('El programa se cerrara. Por favor seleccione de nuevo otra (1 - 5).'); end; ReadKey; end. __________________________________________________________ __________________________________________________________
  • 10. __________________________________________________________ __________________________________________________________ program Vectores; uses crt; var v:array[1..11]of integer; j,i:integer; begin textbackground(5); textcolor(2); clrscr; writeln('Este programa permite almacenar 10 numeros y multiplicarlos por 5.'); writeln('____________________________________________________ _________'); writeln('| | | | | | | | | | |'); writeln('____________________________________________________ _________'); textcolor(yellow); j:=-2; for i:=1 to 10 do begin j:=j+6; gotoxy(j,3); read(v[i]); end; textcolor(7); gotoxy(1,8); writeln('____________________________________________________ _________'); gotoxy(1,9);
  • 11. writeln('| | | | | | | | | | |'); gotoxy(1,10); writeln('____________________________________________________ _________'); textcolor(yellow); j:=-2; for i:=1 to 10 do begin j:=j+6; gotoxy(j,9); write(v[i]*5); end; readkey; end. __________________________________________________________ __________________________________________________________
  • 12. __________________________________________________________ __________________________________________________________ program VectorAscendente; uses crt; var vec:array[1..14]of integer; j,i,aux,n:integer; begin textbackground(4); textcolor(2); clrscr; gotoxy(3,2); writeln('PROGRAMA VECTORES: METODO BURBUJA.'); gotoxy(3,4); writeln('Este programa permite almacenar 13 numeros y ordenarlos de forma ascendente.'); gotoxy(3,6); write('Cuantos datos desea almacenar: '); read(n); while (n<1) or (n>13) do begin gotoxy(3,8); write('Rango del numero no permitido'); gotoxy(3,9); write('Ingrese de nuevo el numero de datos a almacenar: '); clreol; read(n); end; clrscr; j:=-2; for i:=1 to n do begin j:=j+6;
  • 13. gotoxy(j,2); read(vec[i]); end; for i:=1 to n-1 do begin for j:=i+1 to n do begin if vec[i]>vec[j] then begin aux:=vec[i]; vec[i]:=vec[j]; vec[j]:=aux; end; end; end; j:=-2; for i:=1 to n do begin j:=j+6; gotoxy(j,4); textcolor(yellow); write(vec[i]); end; readkey; end. __________________________________________________________ __________________________________________________________
  • 14. __________________________________________________________ __________________________________________________________ program VectorMetodoBurbuja; uses crt; var vec:array[1..13]of integer; j,i,aux,n:integer; begin textbackground(4); textcolor(2); clrscr; gotoxy(3,2); writeln('PROGRAMA VECTORES: METODO BURBUJA.'); gotoxy(3,4); writeln('Este programa permite almacenar 13 numeros y ordenarlos de forma ascendente.'); gotoxy(3,6); write('Cuantos datos desea almacenar: '); read(n); textcolor(yellow); j:=-2; for i:=1 to n do begin j:=j+6; gotoxy(j,8); read(vec[i]); end; for i:=1 to n-1 do begin for j:=i+1 to n do begin if vec[i]>vec[j] then begin
  • 15. aux:=vec[i]; vec[i]:=vec[j]; vec[j]:=aux; end; end; end; j:=-2; for i:=1 to n do begin j:=j+6; gotoxy(j,10); write(vec[i]); end; readkey; end. __________________________________________________________ __________________________________________________________
  • 16. __________________________________________________________ __________________________________________________________ program MatrizGaussJordan; uses crt; var mat:array[1..20,1..10]of real; var resmenu:char; coef,aux:real; i,j,v,n,m:integer; fil,posf,col,posc,cant,opc:integer; //Procedimiento: Portada. procedure portada; begin textbackground(red); textcolor (white); clrscr; gotoxy(20,2); write('SOLUCION DE MATRICES - METODO GAUSS JORDAN'); gotoxy(25,6); write('MAIRA JAMBLEIDY PORRAS GARZON'); gotoxy(25,7); write('JONATHAN YESID VELANDIA FRAILE'); gotoxy(36,8); write('Alumnos:'); gotoxy(22,13); write('AGUSTIN DE JESUS VILLALOBOS FLORIAN'); gotoxy(35,14); write('Ingeniero:'); gotoxy(17,20); write('FUNDACION UNIVERSITARIA DE SAN GIL - UNISANGIL'); gotoxy(29,21); write('INGENIERIA DE SISTEMAS'); gotoxy(30,22);
  • 17. write('ESTRUCTURA DE DATOS'); gotoxy(34,23); write('CHIQUINQUIRA'); gotoxy(38,24); write('2013'); readkey; end; //Procedimiento: Introduccion. procedure introduccion; begin gotoxy(20,2); write('SOLUCION DE MATRICES - METODO GAUSS JORDAN'); gotoxy(4,5); write('La solucion de sistemas de ecuaciones lineales encuentra una amplia'); gotoxy(4,6); write('aplicacion en la CIENCIA y la TECNOLOGIA. Se puede afirmar, que en'); gotoxy(4,7); write('cualquier rama de la Ingenieria existe al menos una aplicacion la'); gotoxy(4,8); write('cual requiera el planteamineto y solucion de tales sistemas.'); gotoxy(4,10); write('Por ello profundizamos en el tema y realizamos el presente programa'); gotoxy(4,11); write('para facilitar su solucion y corrobar respuestas obtenidas cuando se'); gotoxy(4,12); write('hace de forma manual.'); gotoxy(44,24); textcolor(2); write('Presione una tecla para continuar...'); readkey; end;
  • 18. //Procedimiento: Definicion. procedure definicion; begin gotoxy(20,2); write('SOLUCION DE MATRICES - METODO GAUSS JORDAN'); gotoxy(4,5); write('Sistema de ecuaciones lineales de m ecuaciones con n incognitas.'); gotoxy(4,7); write('a11 a12 ... a1n b1'); gotoxy(4,8); write('a21 a22 ... a2n b2'); gotoxy(5,9); write('. . . .'); gotoxy(5,10); write('. . . .'); gotoxy(5,11); write('. . . .'); gotoxy(4,12); write('am1 am2 ... amn bm'); gotoxy(4,14); write('Este metodo permite determinar la solucion de un sistema de ecuaciones'); gotoxy(4,15); write('lineales, encontrar matrices y su inversa; reducciendo el sistema dado'); gotoxy(4,16); write('a otro equivalente en el cual cada ecuacion tiene una incognita menos'); gotoxy(4,17); write('que la anterior. Sus creadores fueron:'); gotoxy(3,19); write('- Carl Friedrinch Gauss.'); gotoxy(3,20); write('- Wilhelm Jordan.'); gotoxy(44,24); textcolor(2); write('Presione una tecla para continuar...'); readkey;
  • 19. end; //Procedimiento: Registro de variables. procedure variables; begin gotoxy(3,2); write('Rango de variables: 2 a 10.'); gotoxy(3,4); write('Digite el numero de variables: '); read(v); while (v<2) or (v>10) do begin gotoxy(3,6); write('Rango de variables no valido...'); gotoxy(3,7); write('Digite de nuevo el numero de variables: '); clreol; readln(v); end; fil:=v; col:=v+1; clrscr; end; //Procedimiento: Marco de la matriz. procedure marco; begin for i:=1 to fil+1 do begin posc:=2+col*6; gotoxy(2,i*2); for j:=2 to posc do write('-'); end; cant:=2+2*fil; for i:=1 to col+1 do begin
  • 20. posc:=-4+i*6; gotoxy(posc,2); for j:=2 to cant do begin gotoxy(posc,j); write('|'); end; end; end; //Procedimiento: Captura de datos. procedure captura; begin for i:=1 to fil do begin posf:=1+(i*2); for j:=1 to col do begin posc:=(j*6)-3; gotoxy(posc,posf); read(mat[i,j]); end; end; end; //Procedimiento: Solucion de la matriz. procedure gauss1; begin for i:=1 to fil do begin coef:=mat[i,i]; for j:=1 to col do begin mat[i,j]:=mat[i,j]/coef; end; if i=1 then begin
  • 21. for m:=2 to fil do begin aux:=mat[m,i]; for n:=1 to col do begin mat[m,n]:=((-1)*(aux)*mat[i,n]+mat[m,n]); end; end; end; if i>1 then begin for m:=1 to i-1 do begin aux:=mat[m,i]; for n:=1 to col do begin mat[m,n]:=((-1)*(aux)*mat[i,n]+mat[m,n]); end; end; for m:=i+1 to fil do begin aux:=mat[m,i]; for n:=1 to col do begin mat[m,n]:=((-1)*(aux)*mat[i,n]+mat[m,n]); end; end; end; end; end; //Procedimiento: Resultados. procedure resultados; begin for i:=1 to fil do begin
  • 22. posf:=1+(i*2); for j:=1 to col do begin posc:=(j*6)-3; gotoxy(posc,posf); write(mat[i,j]:0:1); end; end; end; //Procedimiento:Fin Resultados. procedure fin; begin gotoxy(3,2); write('Que tenga un excelente dia.'); gotoxy(3,3); write('Gracias por utilizar nuestro programa.'); gotoxy(43,24); textcolor(2); write('Presione una tecla para continuar...'); readkey; end; //Procedimiento: Salida. procedure salir; begin gotoxy(3,2); write('Que tenga un excelente dia.'); gotoxy(3,3); write('Gracias por utilizar nuestro programa.'); gotoxy(43,24); textcolor(2); write('Presione una tecla para continuar...'); readkey; end;
  • 23. //Programa Principal.. begin portada; clrscr; resmenu:='s'; while (resmenu='s') or (resmenu='S') do begin clrscr; begin gotoxy(20,2); write('SOLUCION DE MATRICES - METODO GAUSS JORDAN'); gotoxy(14,5); write('1. Introduccion.'); gotoxy(14,6); write('2. Definicion.'); gotoxy(14,7); write('3. Solucion de ejercicios.'); gotoxy(14,8); write('4. Salir.'); gotoxy(14,10); write('Digite la opcion que desea: '); readln(opc); while (opc<1) or (opc>4) do begin gotoxy(14,12); write('Opcion incorrecta...'); gotoxy(14,13); write('Digite de nuevo su opcion: '); clreol; readln(opc); end; clrscr; case opc of 1: begin
  • 25. write('Que tenga un excelente dia.'); gotoxy(3,3); write('Gracias por utilizar nuestro programa.'); gotoxy(43,24); textcolor(2); write('Presione una tecla para continuar...'); readkey; end; end; end. __________________________________________________________ __________________________________________________________
  • 26. __________________________________________________________ __________________________________________________________ program Registros; uses crt; type tregusuario=record idusuario:string [10]; nomusuario:string [30]; edadusuario:integer; end; type tregpagos=record idusuariopago:string[10]; valorusuario:real; fechausuario:string[10]; end; var usuarios:array[1..50] of tregusuario; pagos:array[1..100] of tregpagos; res,resp,resmenu:char; i,j,k:integer; n,m:integer; opc:integer; procedure menu; begin textcolor(2); gotoxy(3,2); write('MENU...'); gotoxy(3,4); write('1. Ingresar usuarios.'); gotoxy(3,5); write('2. Mostrar usuarios.'); gotoxy(3,6);
  • 27. write('3. Ingresar pagos.'); gotoxy(3,7); write('4. Mostrar pagos.'); gotoxy(3,8); write('5. Salir.'); gotoxy(3,10); write('Por favor digite la opcion que desee: '); readln(opc); clrscr; end; procedure capturausuarios; begin textcolor(2); i:=0; res:='s'; while (res='s') or (res='S') do begin clrscr; i:=i+1; gotoxy (3,2); write('Usuario ',i,':'); gotoxy (3,4); write('Digite identificacion del usuario: '); readln(usuarios[i].idusuario); gotoxy (3,5); write('Digite nombre del usuario : '); readln(usuarios[i].nomusuario); gotoxy (3,6); write('Digite edad del usuario : '); readln(usuarios[i].edadusuario); clrscr; gotoxy (3,2); write('Desea ingresar mas usuarios???'); gotoxy (3,3);
  • 28. write('s/n: '); readln(res); end; end; procedure mostrarusuarios; begin for n:=1 to i do begin gotoxy (3,2); write('Identificacion'); gotoxy (3,3+n); write(usuarios[n].idusuario); gotoxy (25,2); write('Nombre'); gotoxy (25,3+n); write(usuarios[n].nomusuario); gotoxy (45,2); write('Edad'); gotoxy (45,3+n); write(usuarios[n].edadusuario); end; end; procedure capturapagos; begin j:=0; resp:='s'; while (resp='s') or (resp='S') do begin clrscr; j:=j+1; gotoxy (3,2); write('Usuario ',j,':'); gotoxy (3,4); write('Digite identificacion del usuario: '); readln(pagos[j].idusuariopago);
  • 29. gotoxy (3,5); write('Digite el pago del usuario : '); readln(pagos[j].valorusuario); gotoxy (3,6); write('Digite la fecha del pago : '); readln(pagos[j].fechausuario); clrscr; gotoxy (3,2); write('Desea ingresar mas pagos???'); gotoxy (3,3); write('s/n: '); readln(resp); end; end; procedure mostrarpagos; begin begin for m:=1 to j do begin gotoxy (3,2); write('Identificacion'); gotoxy (3,3+m); write(pagos[m].idusuariopago); gotoxy (25,2); write('Valor del pago'); gotoxy (25,3+m); write('$ ',pagos[m].valorusuario:0:3); gotoxy (45,2); write('Fecha'); gotoxy (45,3+m); write(pagos[m].fechausuario); end; end; end;
  • 30. begin resmenu:='s'; while (resmenu='s') or (resmenu='S') do begin clrscr; k:=k+1; begin menu; clrscr; case opc of 1: begin capturausuarios; end; 2: begin mostrarusuarios; end; 3: begin capturapagos; end; 4: begin mostrarpagos; end; 5: begin gotoxy(3,2); write('Que tenga un buen dia.'); readkey; exit; end; end; readkey; clrscr; gotoxy(3,2);
  • 31. write('Desea volver al menu???'); gotoxy(3,3); write('s/n: '); readln(resmenu); end; end; end. __________________________________________________________ __________________________________________________________
  • 32. __________________________________________________________ __________________________________________________________ program ARCHIVOS; uses crt; type tregusuario=record idusuario:string [10]; nomusuario:string [30]; edadusuario:integer; end; type tregpagos=record idusuariopago:string[10]; valorusuario:real; fechausuario:string[10]; end; type tarcusuarios = file of tregusuario; tarcpagos = file of tregpagos; var usuarios:tarcusuarios; pagos:tarcpagos; regusuarios:tregusuario; regpagos:tregpagos; c,d,i,j,opc,posc,posd,fi,enc:integer; res,resmenu:char; id:string[12]; con,eliminar:string[20]; procedure eliminardatos; begin textbackground(red); textcolor(white);
  • 33. gotoxy(3,2); write('Por favor digite su contrasena: '); textcolor(red); readln(con); textcolor(white); while (con<>'jonathanvelandia') do begin gotoxy(3,4); write('Contrasena ingresada incorrecta.'); gotoxy(3,5); write('Por favor digite de nuevo su contrasena: '); textcolor(red); readln(con); clreol; textcolor(white); end; clrscr; if (con='jonathanvelandia') then begin gotoxy(3,2); writeln('Datos a eliminar, USUARIOS o PAGOS: '); gotoxy(3,4); readln(eliminar); if (eliminar='usuarios') or (eliminar='USUARIOS') then begin gotoxy (3,6); write('ESTA SEGURO QUE DESEA ELIMINAR SU INFORMACION???'); gotoxy(3,7); write('Para confirmar pulse "S" de lo contrario "N": '); readln(eliminar); if (eliminar='s') or (eliminar='S') then begin rewrite(usuarios);
  • 34. gotoxy (3,9); write('Tu lista de usuarios a sido eliminada.') end; end; if (eliminar='pagos') or (eliminar='PAGOS') then begin gotoxy(3,6); write('ESTA SEGURO QUE DESEA ELIMINAR SU INFORMACION???'); gotoxy(3,7); write('Para confirmar pulse "S" de lo contrario "N": '); readln(eliminar); if (eliminar='s') or (eliminar='S') then begin rewrite(pagos); gotoxy (3,9); write('Tu lista de pagos a sido eliminada.') end; end; end; end; procedure capturausuarios; begin res:='s'; while (res='s') or (res='S') do begin clrscr; c:=filesize(usuarios); seek(usuarios,c); gotoxy (3,2); write('Usuario ',c,':'); gotoxy (3,4); write('Digite identificacion del usuario: '); readln(regusuarios.idusuario); gotoxy (3,5);
  • 35. write('Digite nombre del usuario : '); readln(regusuarios.nomusuario); gotoxy (3,6); write('Digite edad del usuario : '); readln(regusuarios.edadusuario); write(usuarios,regusuarios); clrscr; gotoxy (3,2); write('Desea ingresar mas usuarios???'); gotoxy (3,3); write('s/n: '); readln(res); end; end; procedure mostrarusuarios; begin fi:=4; posc:=0; c:=filesize(usuarios); for i:=1 to c do begin seek(usuarios,posc); read(usuarios,regusuarios); gotoxy (3,2); write('Identificacion'); gotoxy (3,fi); write(regusuarios.idusuario); gotoxy (25,2); write('Nombre'); gotoxy (25,fi); write(regusuarios.nomusuario); gotoxy (45,2); write('Edad'); gotoxy (45,fi); write(regusuarios.edadusuario); posc:=posc+1;
  • 36. fi:=fi+1; if (i mod 15=0) then begin gotoxy(44,24); textcolor(2); write('Presione una tecla para continuar...'); readln; clrscr; fi:=4; gotoxy(44,24); textcolor(2); write('Presione una tecla para continuar...'); textcolor(white); end; end; end; procedure buscarusuarios; begin gotoxy(3,2); write('Digite la identificacion del usuario a buscar: '); readln(id); i:=0; enc:=0; c:=filesize(usuarios); while (not EOF(usuarios)) do begin seek(usuarios,i); read(usuarios,regusuarios); if (regusuarios.idusuario=id) then begin gotoxy(3,4); write('Usuario encontrado.'); gotoxy(3,6); write('Nombre: ', regusuarios.nomusuario); gotoxy(3,7); write('Edad: ', regusuarios.edadusuario);
  • 37. enc:=1; end; i:=i+1; end; if (enc=0) then begin gotoxy(3,4); write('Usuario no encontrado.'); enc:=1; end; end; procedure capturapagos; begin gotoxy(3,2); write('Digite identificacion del usuario para registrar el pago: '); readln(regpagos.idusuariopago); j:=0; enc:=0; d:=filesize(pagos); while (not EOF(usuarios)) do begin seek(pagos,d); read(usuarios,regusuarios); if (regusuarios.idusuario=regpagos.idusuariopago) then begin gotoxy(3,4); write('Usuario encontrado.'); gotoxy(3,5); write('Nombre: ', regusuarios.nomusuario); gotoxy(3,6); write('Edad : ', regusuarios.edadusuario); gotoxy(3,8); write('Digite el pago del usuario: '); readln(regpagos.valorusuario); gotoxy (3,9);
  • 38. write('Digite la fecha del pago : '); readln(regpagos.fechausuario); write(pagos,regpagos); enc:=1; end; j:=j+1; end; if (enc=0) then begin gotoxy(3,4); write('Usuario no encontrado.'); enc:=1; end; end; procedure mostrarpagos; begin fi:=4; posd:=0; d:=filesize(pagos); for j:=1 to d do begin seek(pagos,posd); read(pagos,regpagos); gotoxy (3,2); write('Identificacion'); gotoxy (3,fi); write(regpagos.idusuariopago); gotoxy (25,2); write('Valor del pago'); gotoxy (25,fi); write('$ ',regpagos.valorusuario:0:3); gotoxy (45,2); textcolor(white); write('Fecha'); gotoxy (45,fi); write(regpagos.fechausuario);
  • 39. posd:=posd+1; fi:=fi+1; if (j mod 15=0) then begin gotoxy(44,24); textcolor(2); write('Presione una tecla para continuar...'); readln; clrscr; fi:=4; gotoxy(44,24); textcolor(2); write('Presione una tecla para continuar...'); textcolor(white); end; end; end; procedure buscarpagos; begin gotoxy(3,2); write('Digite la identificacion del usuario: '); readln(id); j:=0; enc:=0; d:=filesize(pagos); while (not EOF(pagos)) do begin seek(pagos,j); read(pagos,regpagos); if (regpagos.idusuariopago=id) then begin gotoxy(3,4); write('Pago del usuario encontrado.'); gotoxy(3,6); write('Valor del pago: ', regpagos.valorusuario:0:3);
  • 40. gotoxy(3,7); write('Fecha: ', regpagos.fechausuario); enc:=1; end; j:=j+1; end; if (enc=0) then begin gotoxy(3,4); write('Pago del usuario no encontrado.'); enc:=1; end; end; begin textbackground(red); resmenu:='s'; while (resmenu='s') or (resmenu='S') do begin clrscr; begin textcolor(white); clrscr; gotoxy(3,2); write('MENU...'); gotoxy(3,4); write('1. Ingresar usuarios.'); gotoxy(3,5); write('2. Mostrar usuarios.'); gotoxy(3,6); write('3. Ingresar pagos.'); gotoxy(3,7); write('4. Mostrar pagos.'); gotoxy(3,8); write('5. Buscar datos de usuarios.'); gotoxy(3,9); write('6. Buscar datos de pagos.');
  • 41. gotoxy(3,10); write('7. Eliminacion de datos.'); gotoxy(3,11); write('8. Salir.'); gotoxy(3,13); write('Por favor digite la opcion que desee: '); readln(opc); while (opc<1) or (opc>8) do begin gotoxy(3,15); write('La opcion ingresada no es la correcta.'); gotoxy(3,16); write('Por favor digite de nuevo su opcion: '); clreol; readln(opc); end; clrscr; assign(usuarios,'C:UsersSELLNETDesktopESTRUCTURA DE DATOSLAZARUSARCHIVOSARCHIVO 01usuarios.dat'); assign(pagos,'C:UsersSELLNETDesktopESTRUCTURA DE DATOSLAZARUSARCHIVOSARCHIVO 01pagos.dat'); reset(usuarios); reset(pagos); case opc of 1: begin capturausuarios; end; 2: begin mostrarusuarios; end; 3:
  • 42. begin capturapagos; end; 4: begin mostrarpagos; end; 5: begin buscarusuarios; end; 6: begin buscarpagos; end; 7: begin eliminardatos; end; 8: begin gotoxy(3,2); write('Que tenga un buen dia!!!'); gotoxy(3,3); write('Presione una tecla para finalizar...'); readkey; exit; end; end; close(usuarios); close(pagos); end;
  • 43. readkey; clrscr; gotoxy(3,2); write('Desea volver al menu???'); gotoxy(3,3); write('s/n: '); readln(resmenu); clrscr; if resmenu='n' then begin gotoxy(3,2); write('Que tenga un buen dia.'); gotoxy(3,3); write('Presione una tecla para finalizar...'); readkey; end; end; end. __________________________________________________________ __________________________________________________________
  • 44. __________________________________________________________ __________________________________________________________ program Punteros; uses crt; var x,y,z:^integer; a,b,c:^char; d,e:char; begin clrscr; gotoxy(30,2); write('USO DE PUNTEROS'); new(a); gotoxy(3,4); write('Ingrese el dato que desea: '); read(a^); d:=pred(a^); e:=pred(d); gotoxy(3,6); writeln(d,' ',e); new(x); x^:=80; new(y); y^:=-30; new(z); z^:=25; gotoxy(3,8); x^:=y^; write(x^,' ',y^); if y^=z^ then begin
  • 47. impares:=impares+1; while i>=0 do begin new(y); y^.dato:=i; y^.siguiente:=x; x:=y; write('Ingrese un numero: '); readln(i); if i>=0 then begin Spares:=Spares+1; if i mod 2=0 then pares:=pares+1; if i mod 2<>0 then impares:=impares+1; end; end; clrscr; while y^.siguiente<>nil do begin writeln(y^.dato); x:=y^.siguiente; dispose(y); y:=x; end; writeln('Los numeros ingresados fueron: ',Spares); writeln('Los numeros pares ingresados fueron: ',pares); writeln('Los numeros impares ingresados fueron: ',impares); readkey; dispose(x); end. __________________________________________________________ __________________________________________________________