'F=(C×9/5)+32
'C=(F-32)×5/9
'计算华氏温度
Private Sub Command1_Click()
Dim F, C
C = Val(Text1.Text)
F = (C * 9 / 5) + 32
MsgBox "华氏温度为" &CStr(F)
End Sub'计算摄氏温度
Private Sub Command2_Click()
Dim F, C
F = Val(Text2.Text)
C = (F - 32) * 5 / 9
MsgBox "摄氏温度为" &CStr(C)
End Sub
Private Sub Command1_Click()Text1 = Val(Text1) * 1.8 + 32End SubPrivate Sub Command2_Click()Text1 = (Val(Text1) - 32) / 1.8End SubCommand1:摄氏度转华氏度
Command2:华氏度转摄氏度
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)