用delphi7 输入年月 判断:是否闰年? 这个月有几天? 这个月的季节? 哪里错了?请大侠指教并改正。谢谢

programProject2;{$APPTYPECONSOLE}usesSysUtils;varx,y:integer;beginwrite('请输入年x:');rea... program Project2;

{$APPTYPE CONSOLE}

uses
SysUtils;
var
x,y:integer;
begin
write('请输入年x:');
readln(x);
write('请输入月y:') ;
readln(y);
if (x mod 4 =0 ) and (x mod 100 <>0 ) or (x mod 400 = 0) then
writeln('这一年是闰年');
case y of
1,3,5,7,8,10,12:writeln('该月有31天');
4,6,9,11:writeln('该月有30天') ;
2:writeln('该月有29天') ;

case y of
3,4,5:writeln('该月为春季');
6,7,8:writeln('该月为夏季');
9,10,11:writeln('该月为秋季');
12,1,2 :writeln('该月为冬季') ;

else
writeln('这一年是平年');
begin
case y of
1,3,5,7,8,10,12:writeln('该月有31天') ;
4,6,9,11:writeln('该月有30天') ;
2:writeln('该月有28天');
end;
case y of
3,4,5:writeln('该月为春季') ;
6,7,8:writeln('该月为夏季') ;
9,10,11:writeln('该月为秋季') ;
12,1,2 :writeln('该月为冬季') ;
end;

{ TODO -oUser -cConsole Main : Insert code here }
end.
展开
 我来答
120203851
2011-03-16 · TA获得超过649个赞
知道小有建树答主
回答量:459
采纳率:100%
帮助的人:706万
展开全部
program Project2;

{$APPTYPE CONSOLE}

uses
SysUtils;
var
x,y:integer;
begin
write('请输入年x:');
readln(x);
write('请输入月y:') ;
readln(y);
if (x mod 4 =0 ) and (x mod 100 <>0 ) or (x mod 400 = 0) then
begin
writeln('这一年是闰年');
case y of
1,3,5,7,8,10,12:writeln('该月有31天');
4,6,9,11:writeln('该月有30天') ;
2:writeln('该月有29天') ;
end;

case y of
3,4,5:writeln('该月为春季');
6,7,8:writeln('该月为夏季');
9,10,11:writeln('该月为秋季');
12,1,2 :writeln('该月为冬季') ;
end;
end
else
begin
writeln('这一年是平年');
case y of
1,3,5,7,8,10,12:writeln('该月有31天') ;
4,6,9,11:writeln('该月有30天') ;
2:writeln('该月有28天');
end;
case y of
3,4,5:writeln('该月为春季') ;
6,7,8:writeln('该月为夏季') ;
9,10,11:writeln('该月为秋季') ;
12,1,2 :writeln('该月为冬季') ;
end;
end;
readln;
{ TODO -oUser -cConsole Main : Insert code here }
end.
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式