高手帮忙编程

高手帮忙编程,第1张

Private Sub Form_click()

Dim n(1 To 100) As Single

Dim i, j, x, temp, m

m = 10

Randomize

For i = 1 To m

n(i) = Int((91 * Rnd) + 10)

Next i

For j = 1 To m - 1

For i = j + 1 To m

If n(i) <= n(j) Then

temp = n(i)

n(i) = n(j)

n(j) = temp

End If

Next

Next

Print "产生10个由100以内的两位数组成的有序序列"

For i = 1 To m

Print n(i)

Next

Do

x = InputBox("插入一个数", "插入框")

If x = "" Then

GoTo l

End If

Print vbCrLf &"插入一个数后重新排序为:"

If x >= n(m) Then

n(m + 1) = x

Else

For i = 1 To m

If x <= n(i) Then

num = i

GoTo ll

End If

Next

ll:

For i = m + 1 To num + 1 Step -1

n(i) = n(i - 1)

Next

n(num) = x

End If

m = m + 1

For i = 1 To m

Print n(i)

Next

Loop While x <>""

l: Unload Me

End Sub

如果你要在网上买,有个东明电子商城,可以看看有没有,再就是淘宝网上找一下。如果要在实体店里买,一般就要到你们所在地的地级市以上的电子商场里找了,县级市一般没有专业的电子商场。这里面就是那个可以录音几秒或是几十秒的模块不太好买,因为那不属于常用或是通用件,最好是在网上买。如果你特别着急用,可以买一个做生意用的那个可以录音的喊话器,把里面的录音模块拆下来装到音乐盒里,就是有一点点贵了,得多花几十块钱。祝你早日成功!

OUT BIT P2.3 //该引脚接蜂鸣器

ORG 0000H

LJMP START

ORG 000BH

INC 20H 中断服务,中断计数器加1

MOV TH0,#0D8H

MOV TL0,#0EFH 12M晶振,形成10毫秒中断

RETI

START:

MOV SP,#50H

MOV TH0,#0D8H

MOV TL0,#0EFH

MOV TMOD,#01H

MOV IE,#82H

MUSIC0:

NOP

MOV DPTR,#DAT 表头地址送DPTR

MOV 20H,#00H 中断计数器清0

MOV B,#00H 表序号清0

MUSIC1:

NOP

CLR A

MOVC A,@A+DPTR 查表取代码

JZ END0 是00H,则结束

CJNE A,#0FFH,MUSIC5

LJMP MUSIC3

MUSIC5:

NOP

MOV R6,A

INC DPTR

MOV A,B

MOVC A,@A+DPTR 取节拍代码送R7

MOV R7,A

SETB TR0 启动计数

MUSIC2:

NOP

CPL OUT

MOV A,R6

MOV R3,A

LCALL DEL

MOV A,R7

CJNE A,20H,MUSIC2 中断计数器(20H)=R7否?

不等,则继续循环

MOV 20H,#00H 等于,则取下一代码

INC DPTR

INC B

LJMP MUSIC1

MUSIC3:

NOP

CLR TR0 休止100毫秒

MOV R2,#0DH

MUSIC4:

NOP

MOV R3,#0FFH

LCALL DEL

DJNZ R2,MUSIC4

INC DPTR

LJMP MUSIC1

END0:

NOP

MOV R2,#64H 歌曲结束,延时1秒后继续

MUSIC6:

MOV R3,#00H

LCALL DEL

DJNZ R2,MUSIC6

LJMP MUSIC0

DEL:

NOP

DEL3:

MOV R4,#02H

DEL4:

NOP

DJNZ R4,DEL4

NOP

DJNZ R3,DEL3

RET

NOP

DAT:

db 26h,20h,20h,20h,20h,20h,26h,10h,20h,10h,20h,80h,26h,20h,30h,20h

db 30h,20h,39h,10h,30h,10h,30h,80h,26h,20h,20h,20h,20h,20h,1ch,20h

db 20h,80h,2bh,20h,26h,20h,20h,20h,2bh,10h,26h,10h,2bh,80h,26h,20h

db 30h,20h,30h,20h,39h,10h,26h,10h,26h,60h,40h,10h,39h,10h,26h,20h

db 30h,20h,30h,20h,39h,10h,26h,10h,26h,80h,26h,20h,2bh,10h,2bh,10h

db 2bh,20h,30h,10h,39h,10h,26h,10h,2bh,10h,2bh,20h,2bh,40h,40h,20h

db 20h,10h,20h,10h,2bh,10h,26h,30h,30h,80h,18h,20h,18h,20h,26h,20h

db 20h,20h,20h,40h,26h,20h,2bh,20h,30h,20h,30h,20h,1ch,20h,20h,20h

db 20h,80h,1ch,20h,1ch,20h,1ch,20h,30h,20h,30h,60h,39h,10h,30h,10h

db 20h,20h,2bh,10h,26h,10h,2bh,10h,26h,10h,26h,10h,2bh,10h,2bh,80h

db 18h,20h,18h,20h,26h,20h,20h,20h,20h,60h,26h,10h,2bh,20h,30h,20h

db 30h,20h,1ch,20h,20h,20h,20h,80h,26h,20h,30h,10h,30h,10h,30h,20h

db 39h,20h,26h,10h,2bh,10h,2bh,20h,2bh,40h,40h,10h,40h,10h,20h,10h

db 20h,10h,2bh,10h,26h,30h,30h,80h,00H

END


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/11264811.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-14
下一篇 2023-05-14

发表评论

登录后才能评论

评论列表(0条)

保存