3x3 lük iki matris üzerinde işlemler
 
'Gireceğiniz iki adet üçe üçlük matris üzerinde toplama,çıkarma ve çarpma işlemleri

Dim MatriceA(2, 2), Matriceb(2, 2), result(2, 2) As Integer


Private Sub Command1_Click()
Text3.Text = ""
For i = 0 To 2
    For j = 0 To 2
   
        result(i, j) = Val(MatriceA(i, j)) + Val(Matriceb(i, j))
        Text3.Text = Text3.Text + Str(result(i, j))
       
    Next j
    Text3.Text = Text3.Text & vbCrLf
Next i


End Sub

Private Sub Command2_Click()
Text3.Text = ""
For i = 0 To 2
    For j = 0 To 2
   
        result(i, j) = Val(MatriceA(i, j)) - Val(Matriceb(i, j))
        Text3.Text = Text3.Text + Str(result(i, j))
       
    Next j
    Text3.Text = Text3.Text & vbCrLf
Next i
End Sub

Private Sub Command3_Click()
Dim k, i, j As Integer
Text3.Text = ""
For k = 0 To 2

    For i = 0 To 2
        Sum = 0
        For j = 0 To 2
            Sum = Sum + Val(MatriceA(k, j)) * Val(Matriceb(j, i))
        Next
       
        Text3.Text = Text3.Text + Str(Sum)
    Next i

Text3.Text = Text3.Text & vbCrLf

Next k

End Sub

Private Sub Command4_Click()

Dim i, j As Integer
Dim msg As String
Dim cancel As Boolean

x = 1
y = 1
enter = vbCrLf

Text1.Text = ""
Text2.Text = ""
cancel = False
For i = 0 To 2              'Matrice A members are creating
    If cancel = True Then Exit For  'If cancel buton clicked in Inputbox break the "for" loop for column
    For j = 0 To 2
        msg = "Enter the value of A[" + Str(i + 1) + "," + Str(j + 1) + "]"
       
        member = InputBox(msg, "Matrices", "1")
        If member = "" Then
            cancel = True
            Exit For
                       
        End If
        MatriceA(i, j) = member
        Text1.Text = Text1.Text + member + " "
       
    Next j
    Text1.Text = Text1.Text & enter
Next i

If cancel = True Then
    Text1.Text = ""
Else

For i = 0 To 2              'Matrice B members are creating
    If cancel = True Then
        Text1.Text = ""
        Text2.Text = ""
        Exit For
    End If
    For j = 0 To 2
        msg = "Enter the value of B[" + Str(i + 1) + "," + Str(j + 1) + "]"
        member = InputBox(msg, "Matrices", "1")
        If member = "" Then
            cancel = True
            Exit For
        End If
        Matriceb(i, j) = member
        Text2.Text = Text2.Text + member + " "
    Next j

    Text2.Text = Text2.Text & vbCrLf
Next i

End If

End Sub


Private Sub Command5_Click()
End
End Sub

 
Yazar: Turk_Ajan
 
 
Bugün 1 ziyaretçi BuRaDaYDı..!

 
 
Bu web sitesi ücretsiz olarak Bedava-Sitem.com ile oluşturulmuştur. Siz de kendi web sitenizi kurmak ister misiniz?
Ücretsiz kaydol