主题:找错
各位大虾,我实在找不出这题哪错了,我是照着书抄的,也没发现错,求大家帮帮忙,找找错。
const ll=5;ln=15;
var
lastn,t:string[ll];
name:string[ln];
i,n,p:integer;
begin
writeln(' write a last name:');
readln(lastn);
writeln('write names:');
n:=0;
repeat
readln(name);
for i:=1 to ll do t[i]:=' ';
p:=1;
while (p<=ll) and (name[p]<>' ') do
begin
t[p]:=name[p]; p:=p+1;
end;
if t=lastn then
begin
writeln(name); n:=n+1;
end
until t='*****';
writeln('last name',' ',lastn,' ','is total',' ',n)
end.
const ll=5;ln=15;
var
lastn,t:string[ll];
name:string[ln];
i,n,p:integer;
begin
writeln(' write a last name:');
readln(lastn);
writeln('write names:');
n:=0;
repeat
readln(name);
for i:=1 to ll do t[i]:=' ';
p:=1;
while (p<=ll) and (name[p]<>' ') do
begin
t[p]:=name[p]; p:=p+1;
end;
if t=lastn then
begin
writeln(name); n:=n+1;
end
until t='*****';
writeln('last name',' ',lastn,' ','is total',' ',n)
end.