大家好ㄚ.... 我手頭上有2個報告~ 但是我不會寫.. 一個是.."魔術方塊"~利用3*3or4*4的矩陣使該矩陣~橫的.直的.斜的~都等於一個數字另一個是"萬年曆"~是輸入想查看的年~它就會把整年的日期~推算出來.. 希望大家能幫幫忙.. 如果可以的話請寄e.mail給我~謝謝大家嘍~^^
另外..這是"魔術方塊"的一些程式..但是卻不能執行~請各為幫幫忙~告訴我是那邊出錯了~好嗎??謝謝各位嘍..^^
Option Explicit
Dim Rows As Integer
Dim Columns As Integer
Dim Magic()
Dim row As Integer
Dim col As Integer
Dim Length As Integer
Private Sub cmdEdit_Click()
Dim number
number = Val(InputBox("Please input ONE ODD Integer you want to make A MAGIC SQUARE ?"))
ReDim Magic(1 To number, 1 To number)
row = 1
col = Round(number / 2)
Magic(row, col) = 1
For Length = 2 To Sqr(number)
If (Length > number) And (Length Mod number = 1) Then
row = row + 1
If row > number Then
row = 1
End If
Magic(row, col) = Length
Else
row = row - 1
If row = 0 Then
row = number
End If
col = col + 1
If col = number + 1 Then
col = 1
End If
Magic(row, col) = Length
End If
Next Length
Print
Print "This is the MAGIC SQURE of ',number,' you want !!!"
Print
For row = 1 To number
For col = 1 To number
Print Magic(row, col)
Next col
Next row
End Sub