主题:去年的NOIP普及组复赛题苹果问题,程序为什么不能读入数据
去年的NOIP普及组复赛题苹果问题,我这样写程序,为什么不能读入数据呢?apple.in和apple.out文件我都写好了的。程序如下:
program apple(input,output);
type
apples=100..200;
tall=100..200;
const
n=30;
var
a:array[1..10]of apples;
h:tall;
x,i:integer;
begin
assign(input,'d:\data\apple.in');
reset(input);
assign(output,'d:\data\apple.out');
rewrite(output);
for i:=1 to 10 do read(a);
readln;
read(h);
x:=0;
for i:=1 to 10 do
if a<=b+n then inc(x);
write(x)
close(input);
close(output);
end.
程序截图:
[img]http://www.ytyz.com.cn/apple.jpg[/img]
program apple(input,output);
type
apples=100..200;
tall=100..200;
const
n=30;
var
a:array[1..10]of apples;
h:tall;
x,i:integer;
begin
assign(input,'d:\data\apple.in');
reset(input);
assign(output,'d:\data\apple.out');
rewrite(output);
for i:=1 to 10 do read(a);
readln;
read(h);
x:=0;
for i:=1 to 10 do
if a<=b+n then inc(x);
write(x)
close(input);
close(output);
end.
程序截图:
[img]http://www.ytyz.com.cn/apple.jpg[/img]