VB程序设计形考作业二

VB程序设计形考作业二,第1张

一、

1)A

2)D

3)B

4)D

5)B

6)C

7)D

8)B

9)B

10)B

二、

1)1

2)12

3)AddList

4)Caption

5)静态

6)Text1.Clear

三、

1)分别是:

s=6

s=11

s=44

你的问得太多了,你是懒虫

1)

Private Sub Command1_Click()

a = Int(Rnd * 100)

Print a

b = Int(Rnd * 100)

Print b

c = a + b

Print "a与b的和是" &c

End Sub

2)

Public Sub myReplace(ByVal s1 As String, ByVal s2 As String, ByVal s3 As String, ByRef s4 As String)

Dim x1%, x2%, x%

x1 = Len(s1)

x2 = Len(s2)

x = 1

Do While x <= x1

s = Mid(s1, x, x2)

If s = s2 Then

s4 = s4 &s3

x = x + x2

Else

s4 = s4 &s

x = x + 1

End If

Loop

End Sub

Private Sub Command1_Click()

Dim s$

myReplace Text1.Text, Text2.Text, Text3.Text, s

Text4.Text = s

End Sub

Public Function IsH(ByVal n As Integer) As Boolean

Dim s$, m%

s = CStr(n)

m = Len(s)

IsH = True

For i = 1 To m \ 2

If Mid(s, i, 1) <>Mid(s, m - i + 1, 1) Then

IsH = False

Exit For

End If

Next i

End Function

Private Sub Command2_Click()

Dim n As Integer

n = InputBox("输入")

Picture1.Print n

If IsH(n) Then

Picture1.Print "★"

Else

Picture1.Print

End If

End Sub


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

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

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

发表评论

登录后才能评论

评论列表(0条)

保存