|
|
back to boardWhy i got crash??? what's wrong??? var a:array[1..1000] of string;v,b,c,n,i:integer; begin b:=0;c:=0;v:=0; read(n); for i:=1 to n+1 do begin readln(a[i]); if a[i]='Emperor Penguin' then v:=v+1; if a[i]='Macaroni Penguin' then b:=b+1; if a[i]='Little Penguin' then c:=c+1; end; if (v>b)and(v>c)then writeln('Emperor Penguin'); if (b>v)and(b>c)then writeln('Macaroni Penguin'); if (c>b)and(c>v)then writeln('Little Penguin'); end. Re: Why i got crash??? Why "for i:=1 to n+1 do"??? Must be "for i:=1 to n do"!!! Re: Why i got crash??? if i do "for i:=1 to n do" then (не знаю как дальше поанглийски) Короче он вводит на 1 меньше Re: Why i got crash??? Posted by Sergey 23 Feb 2010 00:32 Change "read(n)" to "readln(n)". |
|
|