Вы находитесь на странице: 1из 19

UNIVERSIDAD NACIONAL ABIERTA REA DE INGENIERA

CARRERA INGENIERA

TAREA
TRABAJO PRCTICO: X

ASIGNATURA: COMPUTACIN I

CDIGO: 323

FECHA DE ENTREGA AL ESTUDIANTE:


Adjunto a la Primera Prueba Parcial
FECHA DE DEVOLUCIN:
Adjunto a la Prueba Integral

NOMBRE DEL ESTUDIANTE: OSWALDO SEIDEL

CDULA DE IDENTIDAD: V-00.000.000

CENTRO LOCAL:GUARICO

CARRERA: 236/280

NMERO DE ORIGINALES: 01

FIRMA DEL ESTUDIANTE: LAPSO: 2015/2

RESULTADOS DE CORRECCIN:
OBJ. N 5 6 7

0:NL 1:L
Algoritmo TOURSVEN;
Inicio
Definir Registro
Apellidos : carcter;
nombres : carcter;
pasaporte : numrico;
edad : carcter;
sexo : carcter;
fecha_exp : numrico;
origen :carcter;
fecha_vac : numrico;
fecha_declara : numrico;
fin_registro;
variables
n : entero;
otro :carcter;
tipo
datos :registro;

{ Se inicia el procedimiento de Carga de Datos de los Viajeros }


Procedimiento RegistraDatos;
Inicio
Escribir Datos de Viajeros;
Hacer
Escribir Introduzca Nombres y Apellidos;
Leer datos[n].apellidos_nombres;
Escribir Numero de pasaporte;
Leer datos[n].pasaporte;
Escribir Fecha de Expiracion;
Leer datos[n]. fechapas;
Escribir Pais de Origen;
Leer datos[n]origen;
Escribir Fecha de Vacunacion;
Leer datos[n].fechavac;
Escribir Fecha de Declaracion de Impuestos;
Leer datos[n].fechadec;
Escribir Existe otro Viajero?;
Leer otro;
Si otro = S entonces n=n+1;
Sino
Fin Hacer
Fin
{Fin del procedimiento de Carga de Datos de los Viajeros }

{Procedimiento para Modificar Datos de Viajeros}

Procedimiento ModificarDatos;
Var
busca_pasaporte : numrico;
i : numrico;

Inicio
Escribir Modificacion de Datos de Viajeros;
Escribir Introduzca el nmero de Pasaporte a Modificar;
Leer busca_pasaporte;
i=0;
Hacer
Si busca_pasaporte = datos[i].pasaporte entonces
Escribir Introduzca Nombres y Apellidos;
Leer datos[i].apellidos_nombres;
Escribir Numero de pasaporte;
Leer datos[i].pasaporte;
Escribir Fecha de Expiracion;
Leer datos[i].fechapas;
Escribir Pais de Origen;
Leer origen[i];
Escribir Fecha de Vacunacion;
Leer fechavac[i];
Escribir Fecha de Declaracion de Impuestos;
Leer fechadec[i];
Sino entonces i=i+1;

FinSi;
Hasta i=n; {repite hasta el tamao de los datos}
Fin {Fin de Buscar para Modificar}
Procedimiento EliminarDatos;
Var
busca_pasaporte : numrico;
i : numrico;
resp :carcter;

Inicio
Escribir Eliminar de Datos de Viajeros;
Escribir Introduzca el nmero de Pasaporte a Eliminar;
Leer busca_pasaporte;
i=0;
Hacer
Si busca_pasaporte = pasaporte[i] entonces
Escribir Introduzca Nombres y Apellidos;
Leer apellidos_nombres[i];
Escribir Numero de pasaporte;
Leer pasaporte[i];
Escribir Fecha de Expiracion;
Leer fechapas[i];
Escribir Pais de Origen;
Leer origen[i];
Escribir Fecha de Vacunacion;
Leer fechavac[i];
Escribir Fecha de Declaracion de Impuestos;
Leer fechadec [i];
Escribir Desea Eliminar (S/N)
Leer resp;
Si resp=S
Eliminar Registro;
Finsi;

Sino entonces i=i+1;


FinSi;

Hasta i=n; {repite hasta el tamao de los datos}


Fin {Fin de Buscar para Eliminar}
{Procedimiento Reportes}
Procedimiento Reportes;
Inicio
Var
Opcin :entero;
Repetir Hasta opcin=9
Escribir Seleccione un Reporte:
Escribir 1) Reporte Por Numero de Pasaporte;
Escribir 2) Reporte Datos No Vigentes;
Escribir 3) Reporte Nacionalidad;
Escribir 4) Reporte Datos Vigentes;
Escribir 9) Salir;
Leer opcin;
Si opcin=1 hacer
Ordenpasaporte;
Finsi
Si opcin=2 hacer
novigentes;
Finsi
Si opcin=3 hacer
nacionalidad;
Finsi
Si opcin=4 hacer
vigentes;
Finsi
Finrepetir
Fin

{ Se Realizan los Procedimientos de Reporte }


Procedimiento ordenpasaporte;
Variables
i: entero;
j: entero;
temp: datos:

Inicio
i=0;
j=1;
Con datos[i].pasaporte
Si datos[i].pasaporte > datos[j].pasaporte
temp=datos[i];
datos[i]=datos[j];
datos[j]=temp;
finsi
con datos[i] hacer
Escribir Pasaporte :, datos[i].pasaporte;
Fin hacer
Fin

Procedimiento vigentes
Var
Fechaact: cadena;
i: entero;
Inicio
Con datos[i].fechapas
Si datos[i].fechapas > fechaact;
Datos[i].activo=VERDADERO;
Sino
Datos.activo=FALSO;
Finsi
Repetir mientras datos[i].activo=VERDADERO
Escribir datos[i].pasaporte;
Fin
Fin
Procedimiento novigentes
Var
Fechaact: cadena;
i: entero;
Inicio
Con datos[i].fechapas
Si datos[i].fechapas > fechaact;
Datos[i].activo=VERDADERO;
Sino
Datos.activo=FALSO;
Finsi
Repetir mientras datos[i].activo=FALSO
Escribir datos[i].pasaporte;
Fin
Fin

Procedimiento nacionalidad
Var
Fechaact: cadena;
i: entero;
Inicio
Con datos[i].origen
Si datos[i].origen = V;
Escribir Pasportes Venezolanos;
Escribir datos[i].pasaporte;
Sino
Escribir Pasportes Extranjeros;
Escribir datos[i].pasaporte;
Finsi
Fin
Procedimiento Menu;
Var
Opcin: carcter;
Inicio
Mientras opcin <> S
Escribir Tuorsven CA Menu de Opciones;
Escribir (' I = Incluir Viajeros');
Escribir (' C = Consultar Viajeros');
Escribir (' M = Modificar Viajeros');
Escribir (' E = Eliminar Viajeros');
Escribir (' R = Reporte Personalizado');
Escribir (' S = Salir');
Leer opcin
Si opcin = I entonces incluirviajeros;
Si opcin = C entonces consultarviajeros;
Si opcin = M entonces modificarviajeros;
Si opcin = E entonces eliminarviajeros;
Si opcin =R entonces reportes;

FIN
FIN

Programa toursven
Inicio
Men;
Fin
Programa en Pascal

program toursven;
uses
crt, dos;

const
archi = 'toursven.dat';

type
string12 = string[12];
viajero = record
activo : boolean;
pasaporte : longint;
nombre : string[80];
apells : string[80];
edad : integer;
sexo : char;
fechapas : string[12];
origen : char;
fechavac : string[12];
fechadec : string[12];
fechalt : string[12];
fechent : string[12];

end;

var
f : file of viajero;
datos : viajero;
ano, mes, dia, sem : word;

function guardardatos(dd : viajero) : boolean;


begin
guardardatos := false;
assign(f,archi);
{$I-} reset(f); {$I+}
if ioresult <> 0 then
begin
rewrite(f);
seek(f,0);
write(f,dd);
close(f);
guardardatos := true;
end
else
begin
seek(f,filesize(f));
write(f,dd);
close(f);
guardardatos := true;
end;
end;

function diaactual : string12;


var
comm, comd : string[2];
coma : string[4];
begin
getdate(ano,mes,dia,sem);
str(ano,coma);
str(mes,comm);
str(dia,comd);
if length(comd) = 1 then
insert('0',comd,1);
if length(comm) = 1 then
insert('0',comm,1);
diaactual := comd + '/' + comm + '/' + coma;
end;

procedure entradaviajero;
var
tec : char;
begin
clrscr;
writeln('***** Ingreso Viajero *****');
writeln;
with datos do
begin
activo := true;
write(' Num. Pasaporte. : ');
readln(pasaporte);
write(' Nombre : ');
readln(nombre);
write(' Apellidos : ');
readln(apells);
write(' Edad : ');
readln(edad);
write(' Sexo [F/M] : ');
readln(sexo);
write(' Fecha de Expiracion Pasaporte: (dd/mm/yyyy)');
readln(fechapas);
write(' Origen (V) Venezolano (E) Extranjero: ');
readln(origen);
write(' Fecha de Tarjeta Vacunacion: (dd/mm/yyyy)');
readln(fechavac);
write(' Fecha Declaracion Impositiva: (dd/mm/yyyy)');
readln(fechadec);
fechent := diaactual;
writeln;
writeln(' >>> Datos Correctos [S/N] <<<');
repeat
tec := upcase(readkey);
until tec in['S','N'];
if tec = 'S' then
begin
if guardardatos(datos) = true then
writeln(' Datos De Pasajero Guardados ')
else

writeln(' Pulse Una Tecla ');


end;
end;
end;

procedure consultar(num : longint);


var
tt : longint;
dto : viajero;
si : boolean;
begin
si := false;
tt := 0;
assign(f,archi);
{$I-} reset(f); {$I+}
if ioresult <> 0 then
begin
writeln(' Error Archivo No Encontrado Pulse Una Tecla');
readkey;
end
else
begin
for tt := 0 to filesize(f) - 1 do
begin
seek(f,tt);
read(f,dto);
if dto.pasaporte = num then
begin
si := true;
break;
end;
end;
if si = true then
begin
if dto.activo = true then
begin
with dto do
begin
writeln(' Pasaporte = ',pasaporte);
writeln(' Nombre = ',nombre);
writeln(' Apellidos = ',apells);
writeln(' Edad = ',edad);
writeln(' Sexo = ',sexo);
writeln(' fecha Pasaporte = ',fechapas);
writeln(' Vacunas = ');
writeln(' Fecha Declaracion Impuesto =
');
writeln(' Fecha Actual = ',diaactual);
end;
writeln;
end;
end
else
writeln(' El Pasajero No Esta En Lista ');
end;

writeln(' Pulse Una Tecla');


readkey;
end;

procedure modificadatos(num : longint);


var
mo, mdi : viajero;
kk, jh : longint;
term : boolean;
deci : char;
begin
term := false;
assign(f,archi);
{$I-} reset(f); {$I+}
if ioresult <> 0 then
begin
writeln(' Error Archivo No Encontrado Pulse Una Tecla');
readkey;
end
else
begin
for jh := 0 to filesize(f) - 1 do
begin
seek(f,jh);
read(f,mdi);
if mdi.pasaporte = num then
begin
term := true;
kk := jh;
mo := mdi;
break;
end;
end;
if term = true then
begin
if mdi.activo = true then
begin
term := false;
repeat
clrscr;
writeln(' ***** Menu Modificaciones *****');
writeln;
writeln(' P = Pasaporte');
writeln(' N = Nombre');
writeln(' A = Apellidos');
writeln(' E = Declaracion');
writeln(' G = Origen');
writeln(' F = Fecha Pasaporte');
writeln(' S = Salir Y Guardar Cambios');
writeln;
writeln(' <<< Elija Opcion >>>');
repeat
deci := upcase(readkey);
until deci in['N','A','P','E','G','F','S'];
clrscr;
case deci of
'P' : begin
write(' Pasaporte : ');
readln(mo.pasaporte);
end;
'N' : begin
write(' Nombre : ');
readln(mo.nombre);
end;
'A' : begin
write(' Apellidos : ');
readln(mo.apells);
end;
'E' : begin
write(' Edad : ');
readln(mo.edad);
end;
'G' : begin
write(' Origen: ');
readln(mo.origen);
end;
'F' : begin
write(' Fecha Pasaporte : ');
readln(mo.fechapas);
end;
'S' : begin
term := true;
end;
end;
until term = true;
mdi := mo;
seek(f,kk);
write(f,mdi);
end;
end;
close(f);
end;
end;

procedure eliminaviajero(num : longint);


var
hh : longint;
begin
assign(f,archi);
{$I-} reset(f); {$I+}
if ioresult <> 0 then
begin
writeln(' Esta seguro de eliminar Viajero S/N');
readkey;
end
else
begin

for hh := 0 to filesize(f) - 1 do
begin
seek(f,hh);
read(f,datos);
if datos.pasaporte <> num then
begin
end
else
begin
datos.activo := false;
seek(f,hh);
write(f,datos);
end;
end;
close(f);
end;
end;

procedure ordena;
begin
for i := 1 to 8 do
for j := 8 downto t + 1 do
if datos[i].pasaprte < equipos[j].puntos then
begin
aux := datos[j];
datos[j] := datos[i];
datos[j] := aux;
end;
end;

procedure reporte(num : longint);


var

pul : char;
pos, tt : longint;
sil : boolean;
d, m, an : word;
d1, m1, an1 : word;
d3, m3 : word;
dar : string[2];
ay : string[4];
totaldias, error : integer;
begin
assign(f,archi);
{$I-} reset(f); {$I+}
if ioresult <> 0 then
begin
writeln(' Error Archivo No Encontrado Pulse Una Tecla');
readkey;
end
else
begin
sil := false;
for tt := 0 to filesize(f) - 1 do
begin
seek(f,tt);
read(f,datos);
if datos.pasaporte = num then
begin
sil := true;
pos := tt;
break;
end;
end;
if sil = true then
begin
if datos.activo = true then
begin
writeln(' Desea Revisar la Documentacion [S/N]');
repeat
pul := upcase(readkey);
until pul in['S','N'];
if pul = 'N' then
datos.fechalt := diaactual;
if pul = 'S' then
begin
writeln(' Entre Fecha Actual ');
writeln;
write(' Fecha : ');
readln(datos.fechalt);
if datos.fechalt[2] = '/' then
insert('0',datos.fechalt,1);
if datos.fechalt[5] = '/' then
insert('0',datos.fechalt,4);
end;
dar := copy(datos.fechent,1,2);
val(dar,d,error);
dar := copy(datos.fechent,4,2);
val(dar,m,error);
ay := copy(datos.fechent,7,4);
val(ay,an,error);
dar := copy(datos.fechalt,1,2);
val(dar,d1,error);
dar := copy(datos.fechalt,4,2);
val(dar,m1,error);
ay := copy(datos.fechalt,7,4);
val(ay,an1,error);
d3 := 0;
m3 := 0;

d3 := d1 - d;
m3 := m1 - m;

totaldias := (m3 * 30) + d3;


datos.activo := false;
clrscr;
writeln(' ***** Reporte Resumen *****');
writeln;
writeln(' Fecha De Ingreso = ',datos.fechent);
writeln(' Fecha De Pasaporte = ',datos.fechalt);
writeln(' Dias De Declaracion = ',datos.fechadec);
writeln(' Origen = ',datos.origen);

writeln;
writeln(' <<< Pulse Una Tecla >>>');
readkey;
seek(f,pos);
write(f,datos);
close(f);
end
else
begin
writeln(' El Pasaporte No Esta Activo ');
writeln(' <<< Pulse Una Tecla >>>');
readkey;
close(f);
end;
end;
end;
end;

procedure menu;
var
tecla : char;
sal : boolean;
nnm : longint;
begin
sal := false;
repeat
clrscr;
writeln(' ***** Menu ToursVEN*****');
writeln;
writeln(' I = Incluir Viajeros');
writeln(' C = Consultar Viajeros');
writeln(' M = Modificar Viajeros');
writeln(' E = Eliminar Viajeros');
writeln(' R = Reporte Personalizado');
writeln(' S = Salir');
writeln;
writeln(' <<< Elija Opcion >>>');
repeat
tecla := upcase(readkey);
until tecla in['I','C','M','E','R','S'];
clrscr;
case tecla of
'I' : entradaviajero;
'C' : begin
write(' Pasaporte a Consultar : ');
readln(nnm);
consultar(nnm);
end;
'M' : begin
write(' Pasaporte a Modificar: ');
readln(nnm);
modificadatos(nnm);
end;
'E' : begin
write(' Pasaporte a Eliminar : ');
readln(nnm);
eliminaviajero(nnm);
end;
'R' : begin
write(' Nro de Reporte que desea : ');
readln(nnm);
reporte(nnm);
end;
'S' : sal := true;
end;
until sal = true;
end;

begin
clrscr;
menu;
end.

Вам также может понравиться