我有问题!
我必须定义文本文件“T”中偶数行中的感叹号的数量我还必须打印这些字符超过两个的行
我的程序必须是正确的,但 PascalABC 在第 3 行显示错误-“预期类型”
请帮助我或自己写
program text;
var
T: Text;
fName: string;
str: string;
i: integer;
numStr: integer; {Number of current string in file}
amtSymb: integer; {count !}
begin
clrscr;
write('enter input file name: ');
readln(fName);
assign(T,fName);
reset(T); {open file for reading}
numStr := 0;
while not EoF(T) do begin {Reads a line, until we reach the end of file}
readln(T,str);
inc(numStr);
if ((numStr mod 2) = 0) then begin {If an even line}
amtSymb := 0;
for i := 1 to length(str) do begin {We examine each character in the string and read "!"}
if (str[i] = '!') then
inc(amtSymb);
end;
if (amtSymb > 2) then {Display the line if more than two "!"}
writeln(str);
end;
end;
close(T);
writeln('press any key to exit...');
readKey;
end.