我必须从 txt 文件中找出最大的数字。数字例如:
9 8 7 6 5
有人告诉我,它应该可以工作,但它没有,而且我不知道如何使用文件 bcs。
program file;
uses crt;
var i,count,help:integer;
numb:array [1..9] of integer;
f:text;
begin
clrscr;
assign(f,'file1.txt');
reset(f);
readln(f,count);
for i:=1 to count do
readln(f,numb[i]);
close(f);
for i:=2 to count do
begin
if (numb[i-1] < numb[i]) then
help:=numb[i-1];
numb[i-1]:=numb[i];
numb[i]:=help;
end;
for i:=1 to count do
begin
write(numb[i]);
end;
readln;
end.