INDEXADO
-
Upload
igianpiere-nizama-agurto -
Category
Documents
-
view
215 -
download
0
Transcript of INDEXADO
-
8/18/2019 INDEXADO
1/15
INDEXADO
/* Estructura del registro de datos*/
struct Reg_Dx
{
int NR;
char Nombre[15];
char !ellido[15]; int RE;
" rd#ad;
int lrd$si%eo&'struct Reg_Dx(;
/* Encabe%ado del registro de datos*/
struct Encabe%ado_Dx
{
int NR);
int ND;int +RE;
" ed;
int led$si%eo&'struct Encabe%ado_Dx(;
/* Estructura del registro indice */
struct Reg_,nd
{
int NR;
char -la.e_N[15]; int 0R_Nom;
char -la.e_[15];
int 0R_!e;
" ri;
int lri$si%eo&'struct Reg_,nd(;
/* Encabe%ado del registro indice */
struct Encabe%ado_,nd
{
int NR);
" ei;
int lei$si%eo&'struct Encabe%ado_,nd(;
int ⅆ /*chero de datos*/
int &di; /*chero de indices*/
void Reindexar()
{
i&''&dd$o!en'2rchi.o3txt2# 4_RDR((67(
{
cout6628n8n8t8t8t8t8t8tNo existe ningun archi.o 266endl;
cout6628t8t8t8t8t 2;
-
8/18/2019 INDEXADO
2/15
-
8/18/2019 INDEXADO
3/15
Lush'stdin(;
cout6628n8n8n8n8n8n8n8n8n8n8n8n8n8n8t8t8t8t8t2;
cout662 * Nombre 2;
gets'rd3Nombre(;
cout6628n8n8t8t8t8t8t2;
cout662 * !ellido 2;
gets'rd3!ellido(;
cout6628n8n8t8t8t8t2; rd3RE$7;
lm_Dx_M'rd3Nombre# rd3NR # rd3!ellido# cont(;
"
struct uer
{
char -la.e[15];
int 0R;
" N[177]# [177]# +C[177]#auxO#s;
/* )e almacenan los datos ingresados en un .ector de estructuras
el cual se usara como buer */
.oid lm_Dx_M'char N[15]# int nr # char [15] # int i(
{
strc!9'N[i]3-la.e#N(;
N[i]30R$nr;
strc!9'[i]3-la.e#(;
[i]30R$nr;
"
void reconstruirheap( struct Bufer, int n , int i)
{
int hiPoi%Q;
int hiPoder;
int P$7;
// char aux[177];
i&'i6'n/O((
{
hiPoi%Q $ O*iH1;
hiPoder $ O*iHO;
P$hiPoi%Q;
i&''hiPoder6n( :: 'strcm!'+C[hiPoder]3-la.e#+C[P]3-la.e(7( ( /*cambiar signo en
segundo !arentesis !ara e el se arregle descendentement $D */
{
P$hiPoder;
"
i&''strcm!'+C[P]3-la.e#+C[i]3-la.e(7(( /* cambiar signo */
{
auxO$+C[P];
+C[P]$+C[i];
+C[i]$auxO;
reconstruirhea!'*+C#n#P(;
"
-
8/18/2019 INDEXADO
4/15
"
"
void construirheap( struct Bufer , int n )
{
&or' int i$'n/O(A1;i$7;iAA( {reconstruirhea!'*+C#n#i(; "
"
void heapsort (struct Bufer, int n)
{
int m;
// char aux[177];
construirhea!'*N#n(;
m$n;
-
8/18/2019 INDEXADO
5/15
-
8/18/2019 INDEXADO
6/15
read'&di#:ei#lei(;
inicio$1;
nal$ei3NR)H1;
band$7;
-
8/18/2019 INDEXADO
7/15
char !ellido[15];
int nr;
int !os;
int o!$7;
i&''&dd$o!en'2rchi.o3txt2# 4_0EC0((67(
{
cout662rchi.o no se !uede brir266endl;
s9stem'2+)E2(; return;
"
read'&dd#:ed#led(;
Lush'stdin(;
s9stem'2cls2(;
cout6628n8n8n8n8n8n8n8n8n8n8n8n8n8n8t8t8t8t8t2;
cout662usQueda !or 8n8n8n2;
cout6628t8t8t8t [1] Nombre 8n8n8n2;
cout6628t8t8t8t [O] !ellido 8n8n8n2; cout6628t8t8t * 4!cion 2;
cino!;
i&'o!$$1(
{
Lush'stdin(;
s9stem'2cls2(;
cout6628n8n8n8n8n8n8n8n8n8n8n8n8n8n8t8t8t8t8t2;
cout662[*] ,ngrese Nombre 2 ;
gets'Nombre(;
nr$uscar'Nombre#7(;
"
i&'o!$$O(
{
Lush'stdin(;
s9stem'2cls2(;
cout6628n8n8n8n8n8n8n8n8n8n8n8n8n8n8t8t8t8t8t2;
cout662[*] ,ngrese !ellido 2 ;
gets'!ellido(;
nr$uscar'!ellido#1(;
"
i&' nr $$ A1( { cout662rchi.o no se !uede brir266endl; s9stem'2+)E2(;return;"
i&' nr $$ 7 ( { cout662Registro no existe 8n8n2;s9stem'2+)E2(;"
else
{
!os$'nrA1(*lrdHled;
lsee'&dd#!os#7(;
read'&dd#:rd#lrd(;
cout6628n8n8n8n8n8n2;
cout6628t8t8t8t8t8t * Nombre 266rd3Nombre66endl;
cout6628t8t8t8t8t8t * !ellido 266rd3!ellido66endl;
cout6628n8n8n8n8n8n2;
cout6628t8t8t8t8t 2;
s9stem'2+)E2(;
-
8/18/2019 INDEXADO
8/15
"
close'&dd(;
close'&di(;
"
void %ostrar_Dx()
{
s9stem'2cls2(; i&''&dd$o!en'2rchi.o3txt2# 4_0EC0((67({return ;"
i&''&di$o!en'2rchi.o3ind2# 4_0EC0((67({return ;"
cout66endl66endl66endl66endl66endl66endl66endl;
read'&dd# :ed# led(;
cout6628n8t8t***********************rchi.o3txt*********************** 2;
cout6628n8n8t8t+RE 266ed3+RE6628tNR) 266ed3NR)6628tND
266ed3ND66endl;
cout6628t8tNR8tNombre8t!ellido8tre8n2;
cout6628t8tAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA8n2;
-
8/18/2019 INDEXADO
9/15
contHH;
lm_Dx_M'rd3Nombre#rd3NR#rd3!ellido#cont(;
"
"
ctuali%arUista'contH1(; /*ordenamos el buer*/
s9stem'2del rchi.o3ind2(;
i&'' &di $ creat'2rchi.o3ind2#)_,R,0E T )_,RED((67( {return;"
ei3NR)$7; ri3NR$7;
lsee'&di#lei#7(;
Escribir_,nd'*N# *# contH1(;
"
void E!i&inar()
{
char Nombre[15];
char !ellido[15];
int nr; int !os;
int o!$7;
char r!ta$SsS;
i&''&dd$o!en'2rchi.o3txt2# 4_RDR((67(
{
cout662rchi.o no se !uede brir266endl;
s9stem'2+)E2(;
return;
"
read'&dd#:ed#led(;
ed3ND$1;
lsee'&dd#7#7(;
-
8/18/2019 INDEXADO
10/15
gets'Nombre(;
nr$uscar'Nombre#7(;
"
i&'o!$$O(
{
Lush'stdin(;
s9stem'2cls2(;
cout6628n8n8n8n8n8n8n8n8n8n8n8n8n8n8t8t8t8t8t2; cout662[*] ,ngrese !ellido 2 ;
gets'!ellido(;
nr$uscar'!ellido#1(;
"
!os$'nrA1(*lrdHled;
lsee'&dd# !os# 7(;
read'&dd# :rd# lrd(;
rd3RE$ed3+RE;
ed3+RE$rd3NR;
lsee'&dd#!os#7(;
-
8/18/2019 INDEXADO
11/15
{
i&'ed3+RE$$A1(
{
rd3NR$HHed3NR);
lsee'&dd#7#O(;
"
else
{ !os$'ed3+REA1(*lrdHled;
lsee'&dd#!os#7(;
read'&dd#:rd#lrd(;
ed3+RE$rd3RE;
lsee'&dd#!os#7(;
"
Lush'stdin(;
s9stem'2cls2(;
cout6628n8n8n8n8n8n8n8n8n8n8n8n8n8n8t8t8t8t8t2;
cout662 * Nombre 2; gets'rd3Nombre(;
cout6628n8n8t8t8t8t8t2;
cout662 * !ellido 2;
gets'rd3!ellido(;
cout6628n8n8t8t8t8t2;
rd3RE$7;
-
8/18/2019 INDEXADO
12/15
read'&dd#:ed#led(;
ed3ND$1;
lsee'&dd#7#7(;
-
8/18/2019 INDEXADO
13/15
"
"
ad$rd;
tem!$rd3RE;
"
"
i&'o!$$O( {
Lush'stdin(;
s9stem'2cls2(;
cout6628n8n8n8n8n8n8n8n8n8n8n8n8n8n8t8t8t8t8t2;
cout662[*] ,ngrese !ellido 2 ;
gets'!ellido(;
-
8/18/2019 INDEXADO
14/15
close'&dd(;
close'&di(;
"
void Actua!i"ar()
{
char Nombre[15];
char !ellido[15]; int nr;
int !os;
int o!$7;
char r!ta$SsS;
i&''&dd$o!en'2rchi.o3txt2# 4_RDR((67(
{
cout662rchi.o no se !uede brir266endl;
s9stem'2+)E2(;
return;
" read'&dd#:ed#led(;
ed3ND$1;
lsee'&dd#7#7(;
-
8/18/2019 INDEXADO
15/15
lsee'&dd# !os# 7(;