网站建设资讯

NEWS

网站建设资讯

vb.net运动成绩排序 vb成绩排序显示姓名学号成绩

怎么用vb来制作一个成绩排名小程序啊,急!!!

不好意思,老是粘贴错,再改一下,源代码我调试好了以后给你粘贴错了,这段代码我没有调试,不过应该可以的,你试试,不可以的话给我追问,我调试

成都创新互联是一家专业提供新吴企业网站建设,专注与成都网站建设、成都网站设计、HTML5建站、小程序制作等业务。10年已为新吴众多企业、政府机构等服务。创新互联专业的建站公司优惠进行中。

你在vb的安装路径下新建一个text1.txt,用来输入学生成绩和姓名,一个text2.txt,用来保存结果。注意text1.txt格式是这样的,

张3,10

李四,30

王二,40

private sub cmd_click()

dim scount as integer'用来存储学生的个数

scount=inputbox("请输入学生的个数")

dim a() as integer'用来存储文件里的所有数据

redim a(1 to 2*scount)

open app.path"\""text1.txt" for input as#1

for i=1 to 2*scount

input#1,a(i)

next i

close#1

dim b() as integer'用来存储学生成绩

redim b(1 to scount)

dim c() as integer'用来存储学生姓名

redim c(1 to scount)

for i=1 to scount'读入学生成绩

b(i)=a(2*I)

next i

for i=1 to scount'读入学生姓名

c(i)=a(1+2*(i-1))

next i

for i=1 to scount-1'给成绩排序

max=b(i)

for j=i+1 to scount

if b(j)max then

max=b(j)

p=j

temp=b(i)

b(i)=b(p)

b(p)=temp

end if

next j

next i

for i=1 to scount

for j=1 to scount

if b(i)=a(2*j) then

c(i)=a(2*j)

end if

next j

next i

open app.path"\""text2.text" for append as#1

for i=1 to scount

print#1,c(i),b(i)

next i

close#1

end sub

VB.NET中DATAGRIDVIEW做排名(要序号)求助!!!

第一种方式:手动设置,设置列允许重新排列,这样在单击datagridview的列名时,就会自动排序

第二种方式:自动排序,想要按那列排序,就设置那列的SortMode的属性为:Programmatic

VB 带编号排序问题

Private Sub Form_Click()

Dim n(10) As String

Dim s(10) As Double

n(1) = "207号"

s(1) = 14.5

n(2) = "077号"

s(2) = 15.1

n(3) = "156号"

s(3) = 14.2

n(4) = "302号"

s(4) = 14.5

n(5) = "231号"

s(5) = 14.7

n(6) = "453号"

s(6) = 15.2

n(7) = "276号"

s(7) = 13.9

n(8) = "096号"

s(8) = 15

n(9) = "122号"

s(9) = 13.7

n(10) = "339号"

s(10) = 14.9

For i = 1 To 10

For j = i To 10

If s(i) s(j) Then

n(0) = n(j)

s(0) = s(j)

n(j) = n(i)

s(j) = s(i)

n(i) = n(0)

s(i) = s(0)

End If

Next

Next

Me.Print "名次 运动员码 成绩 "

For i = 1 To 10

Me.Print " " + CStr(i) + " " + n(i) + " " + CStr(s(i))

Next

End Sub


网站标题:vb.net运动成绩排序 vb成绩排序显示姓名学号成绩
文章路径:http://cdweb.net/article/doiehho.html