| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 588 人关注过本帖
标题:截取小数
取消只看楼主 加入收藏
jingjingt
Rank: 1
等 级:新手上路
帖 子:11
专家分:0
注 册:2006-5-5
收藏
 问题点数:0 回复次数:3 
截取小数
各位高手:
我将a定义成signal类型,结果为0.123456...但是我想要a的结果为0.1234,请问该怎么办?
搜索更多相关主题的帖子: 小数 
2006-05-20 09:47
jingjingt
Rank: 1
等 级:新手上路
帖 子:11
专家分:0
注 册:2006-5-5
收藏
得分:0 

谢谢版主,还有个问题:
Private Sub TabStrip1_Click()
...
Case 1
Text1.Text = ""
Text2.Text = CInt(Val(b) * 10 ^ 4) / (10 ^ 4) 这里没问题
...
end Select
end sub

Private Sub Command4_Click()
...
Select Case Tabs
Case 1
If q <> 0 Then
s = 1800 * Val(Text3.Text)
Text1.Text = cint(Val(s)*10^4)/(10^4)这里提示有错误
ElseIf q = 0 Then
s = 0
End If
...
End Select
End Sub
我不知道怎么错了
谢谢!


2006-05-21 15:37
jingjingt
Rank: 1
等 级:新手上路
帖 子:11
专家分:0
注 册:2006-5-5
收藏
得分:0 

版主:
谢谢,还是不行!


2006-05-21 20:22
jingjingt
Rank: 1
等 级:新手上路
帖 子:11
专家分:0
注 册:2006-5-5
收藏
得分:0 

Private Sub Command4_Click()
If be <= 2.4 Then
Fwe = 0.87
ElseIf be <= 2.7 And be > 2.4 Then
Fwe = 0.9
ElseIf be <= 3 And be > 2.7 Then
Fwe = 0.93
ElseIf be <= 3.4 And be > 3 Then
Fwe = 0.97
ElseIf be <= 3.7 And be > 3.4 Then
Fwe = 1
ElseIf be <= 4 And be > 3.7 Then
Fwe = 1.03
ElseIf be <= 4.3 And be > 4 Then
Fwe = 1.07
ElseIf be > 4.3 Then
Fwe = 1.1
End If

If bw <= 2.4 Then
Fww = 0.87
ElseIf bw <= 2.7 And bw > 2.4 Then
Fww = 0.9
ElseIf bw <= 3 And bw > 2.7 Then
Fww = 0.93
ElseIf bw <= 3.4 And bw > 3 Then
Fww = 0.97
ElseIf bw <= 3.7 And bw > 3.4 Then
Fww = 1
ElseIf bw <= 4 And bw > 3.7 Then
Fww = 1.03
ElseIf bw <= 4.3 And bw > 4 Then
Fww = 1.07
ElseIf bw > 4.3 Then
Fww = 1.1
End If

If bs <= 2.4 Then
Fws = 0.87
ElseIf bs <= 2.7 And bs > 2.4 Then
Fws = 0.9
ElseIf bs <= 3 And bs > 2.7 Then
Fws = 0.93
ElseIf bs <= 3.4 And bs > 3 Then
Fwe = 0.97
ElseIf bs <= 3.7 And bs > 3.4 Then
Fws = 1
ElseIf bs <= 4 And bs > 3.7 Then
Fws = 1.03
ElseIf bs <= 4.3 And bs > 4 Then
Fws = 1.07
ElseIf bs > 4.3 Then
Fws = 1.1
End If

If bn <= 2.4 Then
Fwn = 0.87
ElseIf bn <= 2.7 And bn > 2.4 Then
Fwn = 0.9
ElseIf bn <= 3 And bn > 2.7 Then
Fwn = 0.93
ElseIf bn <= 3.4 And bn > 3 Then
Fwn = 0.97
ElseIf bn <= 3.7 And bn > 3.4 Then
Fwn = 1
ElseIf bn <= 4 And bn > 3.7 Then
Fwn = 1.03
ElseIf bn <= 4.3 And bn > 4 Then
Fwn = 1.07
ElseIf bn > 4.3 Then
Fwn = 1.1
End If

Select Case Tabs
Case 1
If q1 <> 0 Then q1,q2,q3,q4是全局变量,在上一窗体中赋值
s1 = 1800 * Val(Text1.Text) * Fwe
Text5.Text = Val(s1)
ElseIf q1 = 0 Then
s1 = 0
End If

Case 2
If q2 <> 0 Then
s2 = 1800 * Val(Text2.Text) * Fwe
Text6.Text = Val(s2)
ElseIf q2 = 0 Then
s2 = 0
End If

Case 3
If q3 <> 0 Then
s3 = 1800 * Val(Text3.Text) * Fwe
Text7.Text = Val(s3)
ElseIf q3 = 0 Then
s3 = 0
End If

Case 4
If q4 <> 0 Then
s4 = 1800 * Val(Text4.Text) * Fwe
Text8.Text = Val(s4)
ElseIf q4 = 0 Then
s4 = 0
End If

End Select
End Sub

Private Sub Text1_Change()
be = Val(Text1.Text)
End Sub

Private Sub Text2_Change()
bw = Val(Text2.Text)
End Sub

Private Sub Text3_Change()
bs = Val(Text3.Text)
End Sub

Private Sub Text4_Change()
bn = Val(Text4.Text)
End Sub


2006-05-22 09:17
快速回复:截取小数
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.015497 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved