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 1201. Which Day Is It?

Who can help me?
Posted by NeverGiveUp 8 Apr 2002 19:58
Why my program got "Compilation Error".
if you can help me, i will thank you very much!Thank you.
Here is my grogram:
 const
 way:array[1..31]of string=(' 1',' 2',' 3',' 4',' 5',' 6',' 7',' 8','
9',
                            '10','11','12','13','14','15','16','17','1
8',
                            '19','20','21','22','23','24','25','26','2
7',
                            '28','29','30','31');

var
 a:array[0..6]of string;
 c,day,m,year,days,i,month:integer;

begin
 readln(day,month,year);
 c:=1;fillchar(a,sizeof(a),0);
 a[1]:='mon';a[2]:='tue';a[3]:='wed';a[4]:='thu';
 a[5]:='fri';a[6]:='sat';a[0]:='sun';
 for i:=1 to month-1 do
  case i of
   1,3,5,7,8,10,12: c:=c+31;
   4,6,9,10: c:=c+30;
   2: if ((year mod 4=0)and(year mod 100<>0))or(year mod 400=0) then
c:=c+29 else c:=c+28;
  end;
 days:=trunc((year-1)*(1+1/4-1/100+1/400)+c) mod 7;
 case month of
  1,3,5,7,8,10,12: m:=31;
  4,6,9,10: m:=30;
  2: if ((year mod 4=0)and(year mod 100<>0))or(year mod 400=0) then
m:=29 else m:=28;
 end;
 for i:=1 to days-1 do a[i]:=a[i]+'    ';
 for i:=days to 7 do
  begin
   if i-days+1=day then begin a[i mod 7]:=a[i mod 7]+' ['+way[i-
days+1]+']';Continue;end;
   a[i mod 7]:=a[i mod 7]+'  '+way[i-days+1];
  end;
 for i:=8 to days+m-1 do
  begin
   if i-days+1=day then begin a[i mod 7]:=a[i mod 7]+'  ['+way[i-
days+1]+']';Continue;end;
   if i-days+1=day+7 then begin a[i mod 7]:=a[i mod 7]+'  '+way[i-
days+1];Continue;end;
   a[i mod 7]:=a[i mod 7]+'   '+way[i-days+1];
  end;
 for i:=1 to 7 do writeln(a[i mod 7]);
end.
Re: Who can help me?
Posted by Komandos 8 Apr 2002 21:51
There are very simle answer for your question:
in CASE operator you using label 10 twice!
Compiler returns 'Dublicate label'