(單選,填字母:A.對象名/B.屬性名/C.方法/D.屬性值)。 (2)請?jiān)跈M線處填入合適的代碼。 (3)程序中加框處代碼有錯(cuò),請改正。 Dim n As Integer Dim a(1 To 100*100)As String Private Sub Command1_Click ( ?。?br />Dim i As Integer n=Val(Text1.Text) If n<=100 And n>=2 And n Mod 2=0 Then For i=1 To n*n a(i)=Chr (
)'字符“0“的ASCII碼值為48 '將初始矩陣顯示列表框List1中,代碼略 Next i Else List1.AddItem“輸入有誤“ End If End Sub Private Sub Command2_Click ( ?。?br />Dim b(1 To 100*100)As String,s As String Dim m As Integer,y As Integer,i As Integer,R As Integer,C As Integer m=Val(Text2.Text) If m>=2 And m<=n And m Mod 2=0 Then y=
s=““ For i=1 To n*n R=(i-1)\n+1:C=(i-1)Mod n+1 If R<=y Or R>n-y Or C<=y Or C>n-y Then b(i)=a(i) Else b(i)=a(n*C-R+1)'(3) End If s=s+b(i) If i Mod n=0 Then List2.AddItem s s=““ End If Next i Else List2.AddItem“輸入有誤“ End If End Sub
(選填:能/不能)構(gòu)成“幻圓”。 (2)請?jiān)跈M線處填入合適的代碼。 Dim a(1 To 7)As Integer'a(1)~a(7)依次存儲(chǔ)區(qū)域①~⑦的值 Private Sub Command1_Click ( ?。?br />Dim i As Integer,n As Integer Dim y1 As Integer,y2 As Integer,y3 As Integer For i=1 To 7 a(i)=i Next i n=0 Do While True For i=7 To 2 Step-1 If a(i)=8 Then a(i)=1
End If Next i If a(1)=8 Then Exit Do If check
Then y1=a(1)+a(2)+a(3)+a(4) y2=a(2)+a(4)+a(5)+a(6) y3=a(3)+a(4)+a(6)+a(7) If y1=y2 And
Then n=n+1 '在列表List1中,按格式輸出a數(shù)組元素的值,代碼略 End If End If a(7)=a(7)+1 Loop Label1.Caption=“解法共計(jì)“& Str(n) &“種。“ End Sub Function check
As Boolean Dim i As Integer,n As Integer,f(1 To 8)As Integer For i=1 To 8 f(i)=0 Next i For i=1 To 7
Next i n=0 For i=1 To 7 n=n+f(i) Next i If n=7 Then check=True Else check=False End Function