expected but "ELSE" foundprogram ex111;var a:array[1..100] of integer;n,i,ans,len,tmp,beg:integer;beginread(n);for i:=1 to n doread(a[i]);tmp:=0;ans:=0;len:=0;beg:=0;for i:=1 to n dobeginif tmp+a[i]>ans then beginans:=tmp+a[i];len:=i-beg;end;else if

来源:学生作业帮助网 编辑:作业帮 时间:2024/11/27 07:39:56
expected but ans then beginans:=tmp+a[i];len:=i-beg;end;else if" />
x咻N0_S#B۬qc%N:2"t20 HVb!qCH*> a' :{DM!GTu4NՃ(.6`T!v2>YM\HFHInہ$Ay=9"JFJIZH1!=)HFV3R|WUa1z}X-"XDpQ26x)40Fe10^CJ|J"5TpM`C=oi zLTkƾ.}]NsLggw7+

expected but "ELSE" foundprogram ex111;var a:array[1..100] of integer;n,i,ans,len,tmp,beg:integer;beginread(n);for i:=1 to n doread(a[i]);tmp:=0;ans:=0;len:=0;beg:=0;for i:=1 to n dobeginif tmp+a[i]>ans then beginans:=tmp+a[i];len:=i-beg;end;else if
expected but "ELSE" found
program ex111;
var
a:array[1..100] of integer;
n,i,ans,len,tmp,beg:integer;
begin
read(n);
for i:=1 to n do
read(a[i]);
tmp:=0;
ans:=0;
len:=0;
beg:=0;
for i:=1 to n do
begin
if tmp+a[i]>ans then
begin
ans:=tmp+a[i];
len:=i-beg;
end;
else if (tmp+a[i]=ans) and (i-beg>len) then
len:=i-beg
if tmp+a[i]

expected but "ELSE" foundprogram ex111;var a:array[1..100] of integer;n,i,ans,len,tmp,beg:integer;beginread(n);for i:=1 to n doread(a[i]);tmp:=0;ans:=0;len:=0;beg:=0;for i:=1 to n dobeginif tmp+a[i]>ans then beginans:=tmp+a[i];len:=i-beg;end;else if
主要是else前面的end后面应该没有;号.
program ex111;
var
a:array[1..100] of integer;
n,i,ans,len,tmp,beg:integer;
begin
read(n);
for i:=1 to n do
read(a[i]);
tmp:=0;
ans:=0;
len:=0;
beg:=0;
for i:=1 to n do
begin
if tmp+a[i]>ans then
begin
ans:=tmp+a[i];
len:=i-beg;
end
else if (tmp+a[i]=ans) and (i-beg>len) then
len:=i-beg;
if tmp+a[i]