分类：电脑/网络-软件
问题：VB编写程序1.输入月和日,计算这一天是一年的第几天,提示:每个 
1.输入月和日,计算这一天是一年的第几天,提示:每个月的天数可以用一个整数数组保存.2.让用户输入5个数字,然后按照从大到小的顺序输出(这是程序设计中"关于数组"的习题,大家帮个忙!)
回答：请往窗体上添加一个ommand先.1.'比较简单 日期有效性验证未做Dim month(1 To 12) As IntegerPrivate Sub Command1_Click()Dim temp As StringDim md() As Stringtemp = InputBox("请输入月和日,月和日之间请用一个空格隔开...")If temp <> "" Thenmd = Split(Trim(temp), " ")If UBound(md) < 1 ThenMsgBox "格式错误,您没输入月份或者日期,月份和日期间请用一个逗号隔开", vbExclamation, "格式错误"Exit SubEnd IfIf Int(md(0)) < 1 Or Int(md(0)) > 12 Or Int(md(1)) < 0 Or Int(md(1)) > 31 ThenMsgBox "月份或者日期不符合实际!", vbExclamation, "数据不合法"Exit SubEnd IfMsgBox "这是一年中的第 " & (month(Int(md(0))) + Int(md(1))) & " 天"End IfEnd SubPrivate Sub Form_Load()month(1) = 0: month(2) = 31: month(3) = 59: month(4) = 90month(5) = 120: month(6) = 151: month(7) = 181: month(8) = 212month(9) = 243: month(10) = 273: month(11) = 304: month(12) = 334End Sub2.Private Sub Command1_Click()Dim arry(4) As Integer, temp As IntegerDim i As Integer, j As IntegerFor i = 0 To 4arry(i) = InputBox("请输入第" & i + 1 & "个整数:")NextFor i = 1 To 4  '这里使用冒泡排序法排序For j = 0 To 3If arry(i) > arry(j) Thentemp = arry(i)arry(i) = arry(j)arry(j) = tempEnd IfNext j, iFor i = 0 To 4Print arry(i)NextEnd Sub