首次接触VB,以下就先进行VB中的排序问题

                
 Dim a As Integer

Dim b As Integer

Dim c As Integer

Dim d As Integer

Dim e As Integer

Dim f As Integer

Dim g As Integer

Dim h As Integer

Dim i As Integer

Dim j As Integer

Dim k As Integer

Dim l As Integer

Dim m As Integer

Dim n As Integer

Dim o As Integer





Private Sub Command1_Click()





Cls

Me.Font.Size = 50





a = Int(Rnd * 1000)

b = Int(Rnd * 1000)

c = Int(Rnd * 1000)

d = Int(Rnd * 1000)

e = Int(Rnd * 1000)

f = Int(Rnd * 1000)

g = Int(Rnd * 1000)

h = Int(Rnd * 1000)

i = Int(Rnd * 1000)

j = Int(Rnd * 1000)

k = Int(Rnd * 1000)

l = Int(Rnd * 1000)

m = Int(Rnd * 1000)

n = Int(Rnd * 1000)

o = Int(Rnd * 1000)

If a < b Then

 Call swap(a, b)

End If

If a < c Then

 Call swap(a, c)

End If

If a < d Then

 Call swap(a, d)

End If

If a < e Then

 Call swap(a, e)

End If

If a < f Then

 Call swap(a, f)

End If

If a < g Then

Call swap(a, g)

End If

If a < h Then

Call swap(a, b)

End If

If a < i Then

Call swap(a, h)

End If

If a < j Then

Call swap(a, j)

End If

If a < k Then

Call swap(a, k)

End If

If a < l Then

Call swap(a, l)

End If

If a < m Then

Call swap(a, m)

End If

If a < n Then

Call swap(a, n)

End If

If a < o Then

Call swap(a, o)

End If

If b < c Then

Call swap(b, c)

End If

If b < d Then

Call swap(b, d)

End If

If b < e Then

Call swap(b, e)

End If

If b < f Then

Call swap(b, f)

End If

If b < g Then

Call swap(b, g)

End If

If b < h Then

Call swap(b, h)

End If

If b < i Then

Call swap(b, i)

End If

If b < j Then

Call swap(b, j)

End If

If b < k Then

Call swap(b, k)

End If

If b < l Then

Call swap(b, l)

End If

If b < m Then

Call swap(b, m)

End If

If b < n Then

Call swap(b, m)

End If

If b < o Then

Call swap(a, o)

End If

If c < d Then

Call swap(c, d)

End If

If c < e Then

Call swap(c, e)

End If

If c < f Then

Call swap(c, f)

End If

If c < g Then

Call swap(c, g)

End If

If c < h Then

Call swap(c, h)

End If

If c < i Then

Call swap(c, i)

End If

If c < j Then

Call swap(c, j)

End If

If c < k Then

Call swap(c, k)

End If

If c < l Then

Call swap(c, l)

End If

If c < m Then

Call swap(c, m)

End If

If c < n Then

Call swap(c, n)

End If

If c < o Then

Call swap(c, o)

End If

If d < e Then

Call swap(d, e)

End If

If d < f Then

Call swap(d, f)

End If

If d < g Then

Call swap(d, g)

End If

If d < h Then

Call swap(d, h)

End If

If d < i Then

Call swap(d, i)

End If

If d < j Then

Call swap(d, j)

End If

If d < k Then

Call swap(d, k)

End If

If d < l Then

Call swap(d, l)

End If

If d < m Then

Call swap(d, m)

End If

If d < n Then

Call swap(d, n)

End If

If d < o Then

Call swap(d, o)

End If

If e < f Then

Call swap(e, f)

End If

If e < g Then

Call swap(e, g)

End If





If e < h Then

Call swap(e, h)

End If





If e < i Then

Call swap(e, i)

End If





If e < j Then

Call swap(e, j)

End If





If e < k Then

Call swap(e, k)

End If





If e < l Then

Call swap(e, l)

End If





If e < m Then

Call swap(e, m)

End If





If e < n Then

Call swap(e, n)

End If





If e < o Then

Call swap(e, o)

End If

If f < g Then

Call swap(f, g)

End If





If f < h Then

Call swap(f, h)

End If

If f < i Then

Call swap(f, i)

End If

If f < j Then

Call swap(f, j)

End If

If f < k Then

Call swap(f, k)

End If

If f < l Then

Call swap(f, l)

End If

If f < m Then

Call swap(f, m)

End If

If f < n Then

Call swap(f, n)

End If

If f < o Then

Call swap(f, o)

End If





If g < h Then

Call swap(g, h)

End If

If g < i Then

Call swap(g, i)

End If

If g < j Then

Call swap(g, j)

End If

If g < k Then

Call swap(g, k)

End If

If g < l Then

Call swap(g, l)

End If

If g < m Then

Call swap(g, m)

End If

If g < n Then

Call swap(g, n)

End If

If g < o Then

Call swap(g, o)

End If

If h < i Then

Call swap(h, i)

End If





If h < j Then

Call swap(h, j)

End If





If h < k Then

Call swap(h, k)

End If





If h < l Then

Call swap(h, l)

End If





If h < m Then

Call swap(h, m)

End If









If h < n Then

Call swap(h, n)

End If





If h < o Then

Call swap(h, o)

End If

If i < j Then

Call swap(i, j)

End If





If i < k Then

Call swap(i, k)

End If

If i < l Then

Call swap(i, l)

End If

If i < m Then

Call swap(i, m)

End If

If i < n Then

Call swap(i, n)

End If





If i < o Then

Call swap(i, o)

End If

If j < k Then

Call swap(j, k)

End If

If j < l Then

Call swap(j, l)

End If

If j < m Then

Call swap(j, m)

End If

If j < n Then

Call swap(j, n)

End If

If j < o Then

Call swap(j, o)

End If

If k < l Then

Call swap(k, l)

End If

If k < m Then

Call swap(k, m)

End If

If k < n Then

Call swap(k, n)

End If

If k < o Then

Call swap(k, o)

End If

If l < m Then

Call swap(l, m)

End If





If l < n Then

Call swap(l, n)

End If





If l < o Then

Call swap(l, o)

End If

If m < o Then

Call swap(m, o)

End If

If m < n Then

Call swap(m, n)

End If

If m < o Then

Call swap(m, o)

End If





If n < o Then

Call swap(n, o)

End If









Print a & "," & b & "," & c & "," & d & ", " & e & "," & f & "," & g & "," & h & "," & i & "," & j & "," & k & "," & l & "," & m & ", " & n & "," & o

End Sub









Private Sub swap(ByVal x As Integer, ByVal y As Integer)

Dim temp As Integer

If x < y Then

temp = x

 x = y

 y = temp

 End If

  做完这个编程我的手已经残废,但毕竟这是我做的第一份编程,感觉苦点累点也值得。接触到VB这门课,我感觉自己不再对程序员这样的动物陌生了,慢慢的了解了他们的生活,就是把自己想要完毕的事变成字符敲到电脑上汇成编程

                                               

                                              马妮娜原创

VB中的排序问题 15个的更多相关文章

  1. java Collection中的排序问题

    java Collection中的排序问题 这里讨论list.set.map的排序,包括按照map的value进行排序. 1)list排序 list排序可以直接采用Collections的sort方法 ...

  2. 小工具:天气查询 Vs自定义设置 DevGridControl中GridView排序问题 小工具:火车票查询 小工具:邮件发送 小工具:截图&简单图像处理

    小工具:天气查询   开发一个天气查询的工具主要由两步构成,一是数据的获取,二是数据的展示.  一.数据获取 数据获取又可以分为使用其它公司提供的API和手动抓取其它网站数据. 1. 某公司提供的AP ...

  3. VB中 '&' 和 '+' 号的区别

    释义 &(Ampersand)是英语单字and之代表符号,亦可用作中文中的“和”.“与”之代表符号.这个符号源于拉丁文的et的连写. 可读做 ampersand,即 "and per ...

  4. VB 中 NumericUpDown 控件 如何为手动输入设定触发事件

    Private Sub numDuration_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) ...

  5. VB 中Sub和Function的区别

    Sub可以理解为执行一个过车,一个操作. Function在执行完过后,还要返回一个结果. Sub:过程:Function:函数,可以带返回值. 语法: Sub SubName(参数1,参数2,... ...

  6. VB中的API详解

    一.API是什么? 这个我本来不想说的,不过也许你知道其它人不知道,这里为了照顾一下新手,不得不说些废话,请大家谅解. Win32 API即为Microsoft 32位平台的应用程序编程接口(Appl ...

  7. VB中 ByRef与ByVal区别

    函数调用的参数传递有"值传递"和"引用传递"两种传递方式.如果采用"值传递",在函数内部改变了参数的值,主调程序的对应变量的值不会改变:如果 ...

  8. 【转】VB中应用DDE

    动态数据交换(dde)是windows应用程序间通讯的基本方法之一,在动态数据交换的过程中,提供数据和服务的应用程序称为服务器,请求数据或服务的应用程序则称为客户. dde交谈是由客户程序启动的.如果 ...

  9. VB中的+与&符号的区别

    字符串运算符和字符串表达式 字符串运算符的作用是将两个字符串连接成一个字符串,经常形象的叫做连接符. 在VB中就提供了两种连接用的字符串运算符 “&”.“+” 例如  “VB”+“编程入门” ...

随机推荐

  1. 厦门海沧区磁盘只有1TB的解决方案

    厦门海沧区磁盘只有1TB的解决方案 1.为WINDOWS 2008 r2 服务器增加5个1T的硬盘 2.打开命令提示符,并键入 diskpart. 3.在“DISKPART”提示符下,键入 list ...

  2. ASP.NET webFrom

    web窗体的后缀名.aspx 1.<% %> 标签内的代码在服务器上执行 <body> <form id="form1" runat="se ...

  3. Codeforces Round #445 D. Restoration of string【字符串】

    D. Restoration of string time limit per test 2 seconds memory limit per test 256 megabytes input sta ...

  4. HDU 5915 The Fastest Runner Ms. Zhang (CCPC2016 长春 E题,分类讨论 + 求字典序最小的直径 + 数据结构寻找最小值)

    题目链接  CCPC2016 Changchun Problem E 题意  给定一个$n$个点$n$条边的无向图,现在从某一点$s$出发,每个点都经过一遍,最后在$t$点停止,经过的边数为$l$   ...

  5. kibana-metric

    1. Visualize 新建图形 2. 选择图形类型 3. 选择索引 4. 设置metric参数 4.1 count 4.2 unique count 5. 保存图形

  6. KD-Tree复习笔记(BZOJ1941 & BZOJ2648 & BZOJ4066)

    快一年了都没碰到什么必须用KDT的题目导致模板完全忘光了,重新复习了一下. K_Dimention_Tree是一种用来处理二维以上问题的数据结构(OI中一般都是二维),本质是二维启发式估价函数实现剪枝 ...

  7. Oracle提示密码快过期的解决办法

    今天在使用ORACLE时报出如下错误:ORA-28002: the password will expire within 7 days================================ ...

  8. 十. 图形界面(GUI)设计2.框架窗口

    窗口是GUI编程的基础,小应用程序或图形界面的应用程序的可视组件都放在窗口中,在GUI中,窗口是用户屏幕的一部分,起着在屏幕中一个小屏幕的作用.有以下三种窗口: Applet窗口:Applet类管理这 ...

  9. Word中如何公式居中标号右对齐

    1.鼠标居中 2.插入一行三列表格 3.选中第一个表格,右键-表格属性-单元格-选项:然后回到单元格设置垂直居中,宽度为15%,同理第三个单元格,不过中间单元格也要设置,宽度为70%,这个word没有 ...

  10. ife2015-task2-4-5

    task2-4.html<!DOCTYPE html><html><head lang="en"> <meta charset=" ...