Cls
Randomize (Timer)
Dim A() As Integer, B() As Integer, C() As Long
m = Int(Rnd * 6 + 2)
n = Int(Rnd * 6 + 2)
t = Int(Rnd * 6 + 2)
ReDim A(m - 1, n - 1), B(n - 1, t - 1), C(m - 1, t - 1)
Print "Matrix A(" & m & "×" & n & "):"
For i = LBound(A, 1) To UBound(A, 1)
For j = LBound(A, 2) To UBound(A, 2)
A(i, j) = Int(Rnd * 10)
Print A(i, j)
Next j
Next i
Print "Matrix B(" & n & "×" & t & "):"
For i = LBound(B, 1) To UBound(B, 1)
For j = LBound(B, 2) To UBound(B, 2)
B(i, j) = Int(Rnd * 10)
Print B(i, j)
Next j
Next i
Print "Matrix A×B(" & m & "×" & t & "):"
For i = LBound(A, 1) To UBound(A, 1)
For j = LBound(B, 2) To UBound(B, 2)
For k = LBound(A, 2) To UBound(A, 2)
C(i, j) = C(i, j) + A(i, k) * B(k, j)
Next k
Print Format(C(i, j), "000") + Space(2)
Next j
Next i
End Sub Private Sub Command1_Click()
Cls
Randomize (Timer)
Dim A() As Integer, B() As Integer
m = Int(Rnd * 6 + 2)
n = Int(Rnd * 6 + 2)
ReDim A(m - 1, n - 1), B(n - 1, m - 1)
Print "Matrix A(" & m & "×" & n & "):"
中氏 For i = LBound(A, 1) To UBound(A, 1)
For j = LBound(A, 2) To UBound(A, 2)
A(i, j) = Int(Rnd * 10)
Print A(i, j)
Next 型蚂j
Next i
Print "Transpose of matrix A(" & n & "×" & m & "):"
For i = LBound(B, 1) To UBound(B, 1)
For j = LBound(B, 2) To UBound(B, 2)
B(i, j) = A(j, i)
Print B(i, j)
卜培埋 Next j
Next i
End Sub
数学式子 a <x <b程序里要这样表示 a<x and x <知袜脊樱 b
所以,你的代码要这样:
Pi = 3.1415926
h = 20
fai0 = 50 * Pi / 180
omiga = 10
fai00 = 90 * Pi / 180
fais = 100 * Pi / 180
For jiao = 0 To 360 Step 0.01
fai = jiao * Pi / 180
If 0 <= fai And fai <= fai0 Then
s = h * (fai / fai0 - 1 / (2 * Pi) * Sin(2 * Pi * fai / fai0))
ElseIf fai0 <fai And fai <fai0 + fais Then
s = h
ElseIf (fai0 + fais) <= fai And fai <= (fai0 + fais + 0.5 * fai00) Then
s = h - 2 * h * (fai - fai0 - fais) ^ 2 / fai00 ^ 2
ElseIf (fai0 + fais + 0.5 * fai00) <fai And fai <搭野激= (fai0 + fais + fai00) Then
s = 2 * h * (fai0 + fais + fai00 - fai) ^ 2 / fai00 ^ 2
Else
s = 0
End If
Next
Private Sub mnu_clear_Click() '清除Text1.Text = ""
End Sub
Private Sub mnu_end_Click() '结束
Unload Me
End Sub
Private Sub mnu_FontCT_Click() '粗体
Text1.FontBold = True
End Sub
Private Sub mnu_FontSize12_Click() '洞激12号字
Text1.FontSize = 12
End Sub
Private Sub mnu_FontSize16_Click() '16号字吵改
Text1.FontSize = 16
End Sub
Private Sub mnu_FontXT_Click() '斜纳碰袜体
Text1.FontItalic = True
End Sub
Private Sub Text1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) 'd出菜单,textbox自身有d出菜单,需要多点几次才出现。
If Button = vbRightButton Then
Me.PopupMenu mnu2
End If
End Sub
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)