我只给出一个判断是否为闰年的算法,致于季节,多少天这个问题你可以自己解决了
int leapyear(int year) //判断某年是否闰年 闰年返回1,平年返回0
{
if ((year%400==0) || (year%100!=0) && (year%4==0))
return 1;
else
return 0;
}
'将以下内容复到记事本中 然后 保存为 Form1.Frm
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 4830
ClientLeft = 60
ClientTop = 450
ClientWidth = 8325
LinkTopic = "Form1"
ScaleHeight = 4830
ScaleWidth = 8325
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command1
Caption = "Command1"
Height = 495
Left = 3315
TabIndex = 0
Top = 1905
Width = 1215
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim y$, m$, S$
y = Val(InputBox("请输入年(四位)", , "1999"))
m = Val(InputBox("请输入月", , "1"))
S = y & "年是 " & IIf(DateDiff("D", CDate(y & "-2-1"), CDate(y & "-3-1")) = 29, "闰年", "平年") & vbCrLf
S = S & y & "年" & m & "月是第 " & Mid("一二三四", DateDiff("D", CDate(y & "-1-1"), CDate(y & "-" & m & "-15")) \ 90 + 1, 1) & " 季度" & vbCrLf
S = S & y & "年" & m & "月有 " & DateDiff("D", CDate(y & "-" & m & "-1"), CDate(y & "-" & m + 1 & "-1")) & " 天" & vbCrLf
MsgBox S
End Sub