VB³ÌÐòÉè¼ÆÏ°Ì⼯£¨¸½´ð°¸£© ÏÂÔØ±¾ÎÄ

For j = 1 To 6

a(i, j) = Int(Rnd * 90 + 10) s = s + a(i, j) Print a(i, j); Next j Print Next i Print Print Print s End Sub

16¡¢±àдһ¸öÇó1£«2£«3£«?£«nµÄº¯Êý£¬µ¥»÷ÃüÁî°´Å¥£¨Command1£©Ê±µ÷Óøú¯ÊýÇó1£«2£«3£«4£«5µÄÖµ£¬½á¹ûÏÔʾÔÚÒ»¸öÎı¾¿ò£¨Text1£©ÖС£

Option Base 1

Private Sub Command1_Click() Text1.Text = F(5) End Sub

Public Function F(n As Integer) As Integer For i = 1 To n F = F + i Next i

End Function

17¡¢±àд³ÌÐò£¬ÅжÏÒ»¸öÊýNÊÇ·ñÊÇÆæÊý¡£ÒªÇóʹÓÃͨÓùý³Ì¡£

Private Sub Command1_Click() Dim n As Integer

n = Val(InputBox(\ÊäÈëÐèÒªÅжϵÄÊý\ Print F(n) End Sub

Public Function F(n As Integer) As Boolean If n Mod 2 = 0 Then F = False Else

F = True

18¡¢±àдÇó±í´ïʽ

x3?y3?z3µÄÖµµÄFunction¹ý³Ì¡£

Public Function Fact(X As Integer, Y As Integer, Z As Integer) As Single

Fact = Sqr(Abs(X ^ 3 + Y ^ 3 + Z ^ 3))

47

End Function

19¡¢±àдһ¸öÉãÊÏζÈÓ뻪ÊÏζÈת»»µÄͨÓùý³Ì¡£ÔÚÒ»¸öÎı¾¿ò£¨Text1£©ÖÐÊäÈëÉãÊÏζȣ¬µ¥»÷ÃüÁî°´Å¥command1ʱµ÷ÓøÃͨÓùý³ÌÔÚÁíÒ»¸öÎı¾¿ò£¨Text2£©ÖÐÏÔʾ¶ÔÓ¦µÄ»ªÊÏζȡ£ÉãÊÏζȣ¨C£©Ó뻪ÊÏζȣ¨F£©×ª»»µÄ¹«Ê½ÊÇ£ºF?C?9?5?32¡£

Private Sub Command1_Click() Dim c As Double c = Val(Text1.Text) Text2.Text = CStr(F(c)) End Sub

Public Function F(c As Double) As Double F = c * 9 / 5 + 32 End Function

20¡¢±àдһ¸öÅжÏijÕýÕûÊýNÊÇ·ñÊÇÍêÊýµÄͨÓùý³Ì¡£ÍêÊý£ºÒ»¸öÊýÇ¡ºÃµÈÓÚËüµÄÒò×ÓÖ®ºÍ£¨³ý×ÔÉí£©£¬È磺6£½1£«2£«3£¬Òò´Ë6ÊÇÍêÊý¡£

Public Function F(n As Integer) As Boolean F=False

For i = 1 To n - 1

If n Mod i = 0 Then s = s + i Next i

If s = i Then F = True End Function

21¡¢±àдһ¸öÇóÕýÕûÊýmºÍÕýÕûÊýnµÄ×î´ó¹«Ô¼ÊýµÄº¯Êý¡£

Public Function F(m As Integer, n As Integer) As Integer r = m Mod n While r <> 0 m = n n = r

r = m Mod n Wend F = n End Function

22¡¢±àдһ¸ö¶ÔÊý×éÔªËØ½øÐÐÅÅÐòµÄͨÓùý³Ì¡£

Public Sub P(X() As Integer)

Dim i As Integer, j As Integer, n as integer N=ubound(x) For i = 1 To n - 1 For j = i To n

If X(i) > X(j) Then t = X(i) X(i) = X(j) X(j) = t End If

48