G
Guest
[codebox]Program M65;
uses crt;
type slovo = packed array [1..9] of char;
Number_Phone=100000..999999;
Znakom=record
Family:slovo;
Number:Number_Phone;
end;
Page=array[1..20] of znakom;
zapisnaia=array[1..20] of page;
Procedure Fam(Zp:zapisnaia; Nt:Number_Phone; var F:slovo);
var
i,l:integer;
ext:boolean;
begin
ext:=false;
i:=0;
repeat
inc(i);
l:=0;
repeat
inc(l);
if zp[i,l].Number=nt then begin
f:=zp[i,l].family;
ext:=true;
end;
until (l=20) or (ext);
until (i=20) or (ext);
end;
var
Kniga:zapisnaia;
num:Number_Phone;
f:slovo;
begin
randomize;
clrscr;
f:=' ';
Kniga[1,1].number:=111111;
Kniga[1,1].family:='Сидоров';
Kniga[2,1].number:=211111;
Kniga[2,1].family:=' ‘Петров';
fam(kniga,111111,f);
if f<>' ' then writeln('family: ',f) else writeln('family not found');
readln;
end.[/codebox]
Задача выдаёт не тот результат, что не так подскажите пожалуйста!
uses crt;
type slovo = packed array [1..9] of char;
Number_Phone=100000..999999;
Znakom=record
Family:slovo;
Number:Number_Phone;
end;
Page=array[1..20] of znakom;
zapisnaia=array[1..20] of page;
Procedure Fam(Zp:zapisnaia; Nt:Number_Phone; var F:slovo);
var
i,l:integer;
ext:boolean;
begin
ext:=false;
i:=0;
repeat
inc(i);
l:=0;
repeat
inc(l);
if zp[i,l].Number=nt then begin
f:=zp[i,l].family;
ext:=true;
end;
until (l=20) or (ext);
until (i=20) or (ext);
end;
var
Kniga:zapisnaia;
num:Number_Phone;
f:slovo;
begin
randomize;
clrscr;
f:=' ';
Kniga[1,1].number:=111111;
Kniga[1,1].family:='Сидоров';
Kniga[2,1].number:=211111;
Kniga[2,1].family:=' ‘Петров';
fam(kniga,111111,f);
if f<>' ' then writeln('family: ',f) else writeln('family not found');
readln;
end.[/codebox]
Задача выдаёт не тот результат, что не так подскажите пожалуйста!