VB如何统计数字数量并由大到小排列

如有这样的数字:8699444333333777711111111,计算其数量并由大到小从上向下显示出来
1有8个
3有6个
7有4 个
4有3个
9有2个
8有1个
6有1个

Private Sub Command1_Click() Dim str As String, strTmp As String, intN As Integer, intM As Integer Dim intX As Integer, intY As Integer, intZ As Integer, intW As Integer str = Text1.Text intN = Len(str) For intM = 1 To intN strTmp = UCase(Mid(str, intM, 1)) If IsNumeric(strTmp) Then '数字 intX = intX + 1 ElseIf Asc(strTmp) > 64 And Asc(strTmp) < 91 Then '字母 intY = intY + 1 ElseIf strTmp = " " Then '空格 intZ = intZ + 1 Else '其它 intW = intW + 1 End If Next Text2.Text = "数字个数为:" & intX Text3.Text = "字母个数为:" & intY Text4.Text = "空格个数为:" & intZ Text5.Text = "特殊字符个数为:" & intW End Sub '如果满意我的回答,请采纳.谢谢追问

答非所问……。

温馨提示:内容为网友见解,仅供参考
无其他回答

VB如何统计数字数量并由大到小排列
Private Sub Command1_Click() Dim str As String, strTmp As String, intN As Integer, intM As Integer Dim intX As Integer, intY As Integer, intZ As Integer, intW As Integer str = Text1.Text intN = Len(str) For intM = 1 To intN strTmp = UCase(Mid(str, intM, 1))...

VB怎样把数字按从大到小排列??急求!!!
Private Sub Command1_Click()Dim arr() '设数字存放在arr数组中,数组长度已定义好。Dim i As Integer, j As Integer, t For i = 0 To UBound(arr)For j = i + 1 To UBound(arr)If arr(j) > arr(i) Then t = arr(i)arr(i) = arr(j)arr(j) = t End If Next j Nex...

vb怎么吧输入的数从大到小排和从小到大排
你放一个按钮,三个TEXT!在text1中输入数字,点击按钮,在text2中是从小到大,在text3中,是从大到小,我这边调试通过,,你可以试下,希望对你有帮助!Private Sub Command1_Click()Dim I As Integer Dim Count(9) As Integer Dim Num(100) As String Text2.Text = ""Text3.Text = ""F...

vb 编写一个程序,输入任意10个数字,从中找出最大和最小的数,并给出最...
更好的办法是排序,先把数字在数组中原来的位置记录下来,然后排序后找到最大、最小数,输出结果,排序大概这么写:For i = Min To UBound(Vimt) - 1 For j = i + 1 To UBound(Vimt)ReDim SerAim(i)If Vimt(i) > Vimt(j) Then '这个语句是以小到大排序,数组的第一个就是最小...

vb中输入十个数字,并按照有大到小排序冒泡排序
Private Sub Command1_Click()Dim a(10) As IntegerDim temp As IntegerPrint "输入的原始数字是:";For i = 1 To 10 a(i) = InputBox("请输入第" & i & "个数字") Print a(i) & " ";Next iPrintPrint "排序后的数字是:";For i = 1 To 10 For j = 1 To 10 - ...

...随便输入6个数让它们从小到大排列,和从大到小排列
Dim intNum(5) As Integer, intTemp As Integer Dim i As Integer, j As Integer Dim strTemp As String '随机生成6位数字 Randomize Timer Text1 = Int(Rnd * 1000000)'向数组中储存数字 For i = 0 To 5 intNum(i) = CInt(Mid(Text1, i + 1, 1))Next i '从小到大数组排序 For...

如何用vb设计一个程序,可以将输入的10个以上的数字 按大小顺序排列出来...
其实从思想上来说,就是一个排序的思路问题。排序的方法有很多。说2个最简单的(设让结果从小到大排列)方法一 假设10个数 把第一个依次与他后面的比较,如果比后面的大,就把位子换下,这样当第一个看完后面9个数后第一个数就变成最小的数了 再把第二个依次与后面8个比较,让第二个变成9个...

如何用VB进行排序?
(1)交换排序:参照求最大值和最小值的思想,按升序排序的基本过程是将第一个数字与下一个数字进行比较。如果后面的数字很小,那么交换和第一个数字的位置。否则,不要交换。(2)气泡排序:交换和重复两个相邻数字的过程。一般来说,如果有n个数字要排序,则需要n-1起泡。(3)选择排序:在交换...

用VB编写“任意输入10个数,将它们由大到小进行排序输出到窗体上”的...
For x = 1 To 10 For y = 2 To x If (arr(x) < arr(y)) Then arr(0) = arr(x)arr(x) = arr(y)arr(y) = arr(0)End If Next Next Me.Caption = "输入第 " + CStr(i + 1) + " 个数"Print "大到小:"For m = 1 To 10 Print arr(m)Next End If End Sub ...

输入x,y,z三个数,按从大到小的次序显示用VB程序怎么写
+ 1)Print If x < y Then a = x x = y y = a End If 'x<y If y < z Then a = y y = z z = a 'y<z End If If x < y Then a = x x = y y = a End If 'x<y,此处y为原来的z Print Tab(5); "随机产生数字从大到小排序:"; x; y; z End Sub ...

相似回答