| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 631 人关注过本帖
标题:打字字数的统计问题的解决,请班主检查,谢谢!
只看楼主 加入收藏
lijun337
Rank: 1
等 级:新手上路
帖 子:379
专家分:5
注 册:2006-4-12
结帖率:84.62%
收藏
 问题点数:0 回复次数:0 
打字字数的统计问题的解决,请班主检查,谢谢!

《打字字数的统计问题的解决,请班主检查,谢谢!》

因为上次没有解决空格产生的字数减少问题!而仅仅解决了回车问题,
空格问题又恢复了!表现为字数的减少!


于是又添加了个循环语句和IF语句和TEXT18文本控件,求出文本里所含空格的字数输入到aaaa(见绿字)里面!再将aaaa加进所求字数里!
将最后答案输入到TEXT18里!(见红色字)


经过粗略检查,胡乱回车,空格随意地在文本的任意处添加,无论中间变量如何变化,
均没有发现最终答案发生动摇!

代码如下:

Private Sub Command4_Click()
Timer1.Enabled = False
Text4.Visible = False
Dim c As Single, d As Single, e As Single, f As Single, g As Single, h As Single, s As Single
Dim str2 As String
Dim M2 As Integer
Dim tx2 As Integer
Dim ii As Integer
Dim nn As Integer
Dim k As Integer
Dim p As Integer
Dim r As Single
Dim rr As Single
Dim aaaa, qqqq As Integer

If Text3.Text <> "" Then
For ii = 1 To Len(Text3.Text)
Select Case Asc(Mid(Text3.Text, ii, 1))
Case 0 To 64, 91 To 96, 121 To 127

nn = nn + 1

Case Else
nn = nn
End Select


Next
End If
Text13.Text = nn


M2 = 0

For tx2 = 0 To Len(Text3.Text)
Text3.SelStart = tx2
Text3.SelLength = 1
str2 = Text3.SelText
If str2 = "," Or str2 = "。" Or str2 = "!" Or str2 = "(" Or str2 = ")" Or str2 = "《" Or str2 = "》" Or str2 = "“" Or str2 = "”" Or str2 = ":" Or str2 = ":" Or str2 = "(" Or str2 = ")" Or str2 = ";" Or str2 = "、" Or str2 = "?" Or str2 = "," Or str2 = "." Or str2 = "0" Or str2 = "1" Or str2 = "2" Or str2 = "3" Or str2 = "4" Or str2 = "5" Or str2 = "6" Or str2 = "7" Or str2 = "8" Or str2 = "9" Or str2 = "A" Or str2 = "B" Or str2 = "C" Or str2 = "D" Or str2 = "E" Or str2 = "F" Or str2 = "G" Or str2 = "H" Or str2 = "I" Or str2 = "J" Or str2 = "K" Or str2 = "L" Or str2 = "M" Or str2 = "N" Or str2 = "O" Or str2 = "P" Or str2 = "Q" Or str2 = "R" Or str2 = "S" Or str2 = "T" Or str2 = "U" Or str2 = "V" Or str2 = "W" Or str2 = "X" Or str2 = "Y" Or str2 = "Z" Then M2 = M2 + 1

Next tx2
M2 = M2 / 2

If Text3.Text <> "" Then
Text6.Text = Len(Replace(Text3.Text, " ", "")) - M2
End If

Text10.Text = Text6.Text - Text13.Text

For qqqq = 1 To Len(Text3.Text)
If Mid(Text3.Text, qqqq, 1) = " " Then
aaaa = aaaa + 1
Else
aaaa = aaaa
Text18 = Val(Text10.Text) + aaaa
End If
Next qqqq

c = Val(Text6.Text)
d = Val(Text8.Text)
e = Val(Text7.Text)
f = d / 60
g = e + f
s = c / g
Text5.Text = s

For k = 1 To Len(Replace(Text3.Text, " ", ""))
If Asc(Mid(Replace(Text3.Text, " ", ""), k, 1)) = Asc(Mid(Replace(Text1.Text, " ", ""), k, 1)) Then
p = p
Else
p = p + 1
End If
Text15.Text = p
Text16.Text = Text18.Text
r = 100 * (p / Val(Text18.Text))
Text14.Text = r
If r >= 5 Then
Text4.Visible = True
Text4.Text = "您的错误太多,请继续努力!"

End If
Next k
Command3.SetFocus
End Sub

搜索更多相关主题的帖子: 字数 班主 空格 打字 aaaa 
2006-05-25 19:57
快速回复:打字字数的统计问题的解决,请班主检查,谢谢!
数据加载中...
 
   



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

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