那道练习题是这样的:[设把输入的秒数转化成几天几时几秒(没有几分)]
下面是我写的,不过这可是VB书上一道小小的编程/我这样写明显太繁琐了。有更简单的方法吗?(我是小鸟,请说地详细些。谢谢了)
----------------------------------------------------
Private Sub Form_Click()
Dim zongmiao As Long, hour1 As Integer, second1 As Integer, _
days As Long, hour2 As Integer, yvmiao As Long, second2 As Integer
tishi$ = "请输入要转换的总秒数"
zongmiao = InputBox(tishi$)
If zongmiao < 3600 Then
Print zongmiao; "秒="; "0天0时"; Str$(zongmiao); "秒"
ElseIf zongmiao >= 3600 And zongmiao < 86400 Then
hour1 = zongmiao \ 3600
second1 = zongmiao Mod 3600
Print zongmiao; "秒="; "0天"; hour1; "时"; second1; "秒"
Else
days = zongmiao \ 86400
yvmiao = zongmiao Mod 86400
If yvmiao >= 3600 Then
hour2 = yvmiao \ 3600
second2 = yvmiao Mod 3600
Print zongmiao; "秒="; days; "天"; hour2; "时"; second2; "秒"
Else
Print zongmiao; "秒="; days; "天"; "0时"; yvmiao; "秒"
End If
End If
End Sub
----------------------------------------------------