VB:设计如图的VB程序,实现公用电话收费功能。代码直接写在下面,谢啦 60

 我来答
wanaiavu_0
2014-06-05 · TA获得超过718个赞
知道小有建树答主
回答量:682
采纳率:81%
帮助的人:242万
展开全部
'=========================================================================
'以下代码纯手工打的,可能有问题,也不知道你具体要求,你可以参考一下。
'========================================================================
Dim HH as Integer
Dim MM as Integer
Dim SS as Integer

Dim h as integer
dim m as integer
dim s as integer

'''''开始通话
Sub Command1_Click()
dim tmp as string
tmp = Format(Now,"hh:mm:ss")
Text1.Text = tmp
HH = Var(Left(tmp,2))
SS = Var(Right(tmp,2))
MM= Var(Mid(tmp,4,2))
End Sub

''''结束通话
Sub Command2_Click()
dim tmp as string
Dim tm as double
tmp = Format(Now,"hh:mm:ss")
Text2.Text = tmp
h = Var(Left(tmp,2))
h= Var(Right(tmp,2))
m= Var(Mid(tmp,4,2))

tm = 60*(h-HH)+(m-MM+(s-SS)/60
Text3.Text = Cstr(tm)+"分钟"

End Sb

'''计费

Sub Command3_Click()

dim count as double
dim tm as double
tm = 60*(h-HH)+(m-MM+(s-SS)/60
if(tm<3) Then
Count = 0.5
Else
count = 0.5+0.15*(tm-1)
End If
If HH >= 7 Or HH <=19 Then

Text4.Text = Cstr(count) +"元"

Else
count = count/2
Text4.Text = Cstr(count)+"元"
End if

End Sub

'''清除
Sub Command4_Click()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
End Sub
追问
漏了 一个 timer控件哦,再帮一下忙加上去吧,还有结束通话时的 通话时间怎么在text3上显示
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

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

类别

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

说明

0/200

提交
取消

辅 助

模 式