ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1446. Sorting Hat

Compilation error
Posted by AbdKanan 13 Aug 2006 19:39
I have compilation error. But i think my program is right.


{=== 1446 ===}


const
    Slytherin = 'Slytherin';
    Hufflepuff = 'Hufflepuff';
    Gryffindor = 'Gryffindor';
    Ravenclaw = 'Ravenclaw';
    MAX = 10;

var
    name_arr : array[1..MAX] of string;
    n,i,j : integer;

    Slytherin_arr : array[1..MAX] of string;
    Hufflepuff_arr : array[1..MAX] of string;
    Gryffindor_arr : array[1..MAX] of string;
    Ravenclaw_arr : array[1..MAX] of string;

    Slytherin_i,Hufflepuff_i,Gryffindor_i,Ravenclaw_i : integer;


begin
    readln(n);

    Slytherin_i := 0;
    Hufflepuff_i := 0;
    Gryffindor_i := 0;
    Ravenclaw_i := 0;

    for i:=1 to 2*n do readln(name_arr[i]);


    for i:=1 to 2*n-1 do begin

        if name_arr[i+1] = Slytherin then begin
            Slytherin_arr[i]:=name_arr[i];
            inc(Slytherin_i);
        end;

        if name_arr[i+1] = Hufflepuff then begin
            Hufflepuff_arr[i]:=name_arr[i];
            inc(Hufflepuff_i);
        end;

        if name_arr[i+1] = Gryffindor then begin
            Gryffindor_arr[i]:=name_arr[i];
            inc(Gryffindor_i);
        end;

        if name_arr[i+1] = Ravenclaw then begin
            Ravenclaw_arr[i]:=name_arr[i];
            inc(Ravenclaw_i);
        end;

    end;

    if Slytherin_i>0 then
        write(Slytherin,':');
        writeln('');
        for i:=1 to MAX do if Slytherin_arr[i]<>'' then writeln(Slytherin_arr[i]);
        writeln('');
    end;

    if Hufflepuff_i>0 then
        write(Hufflepuff,':');
        writeln('');
        for i:=1 to MAX do if Hufflepuff_arr[i]<>'' then writeln(Hufflepuff_arr[i]);
        writeln('');
    end;

    if Gryffindor_i>0 then
        write(Gryffindor,':');
        writeln('');
        for i:=1 to MAX do if Gryffindor_arr[i]<>'' then writeln(Gryffindor_arr[i]);
        writeln('');
    end;

    if Ravenclaw_i>0 then
        write(Ravenclaw,':');
        writeln('');
        for i:=1 to MAX do if Ravenclaw_arr[i]<>'' then writeln(Ravenclaw_arr[i]);
    end;


end.
Re: Compilation error
Posted by {AESC USU} Dembel 29 Dec 2006 10:48
delete 67th,74th,81th,87th lines

delete  your code

Edited by author 29.12.2006 10:50
END's WITHOUT BEGIN's
Posted by Alexander Prokazyuk (TKTL) 7 Jan 2007 19:06
Hey when you write answers you use END's WITHOUT BEGIN's
here is part of your code

if Hufflepuff_i>0 then
write(Hufflepuff,':');
writeln('');
for i:=1 to MAX do if Hufflepuff_arr[i]<>'' then writeln(Hufflepuff_arr[i]);
writeln('');
end;   {==Here is END but Where is BEGIN?!?!?!?!?!==}