日全食 pascal程序

来源:百度知道 编辑:UC知道 时间:2024/05/09 12:35:40
日全食近似18个月出现一次,假设2009年7月是第1次,编程求出第n次全食的时间,精确到月
输入n;
输出****nian**yue {如果月份为个位数那么前面补0}

program sunfood;
Var s:array[1..3] of integer; n:integer;
begin writeln('please input the number over 0'); readln(n);
s[1]:=2008; s[2]:=1;
while s[1]<=2250 do begin
s[2]:=s[2]+18; if s[2]<10 then begin
writeln(s[1],'nian','':3,'0',s[2],'yve'); end;
if (s[2]>=10) and (s[2]<=12) then begin
writeln(s[1],'nian','':3,s[2],'yve'); end;
if (s[2]>12) and(s[2]<22) then begin
s[1]:=s[1]+1; s[2]:=s[2]-12;
writeln(s[1],'nian','':3,'0',s[2],'yve');
end; if (s[2]>=22) and (s[1]<=24) then begin
s[1]:=s[1]+1; s[2]:=s[2]-12;
writeln(s[1],'nian','':3,s[2],'yve'); end;
if s[2]>24 then begin
s[1]:=s[1]+2; s[2]:=s[2]-24;
writeln(s[1],'nian