The document contains code for performing various operations on a two-dimensional array including:
1) Finding and displaying the maximum value of each column.
2) Finding and displaying the maximum value of each row.
3) Prompting the user to input the size of the array and values for each element.
4) Sorting the elements of each column in ascending order.
5) Sorting the elements of each row in ascending order.
6) Displaying the final array values.
The document contains code for performing various operations on a two-dimensional array including:
1) Finding and displaying the maximum value of each column.
2) Finding and displaying the maximum value of each row.
3) Prompting the user to input the size of the array and values for each element.
4) Sorting the elements of each column in ascending order.
5) Sorting the elements of each row in ascending order.
6) Displaying the final array values.
Copyright:
Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online from Scribd
The document contains code for performing various operations on a two-dimensional array including:
1) Finding and displaying the maximum value of each column.
2) Finding and displaying the maximum value of each row.
3) Prompting the user to input the size of the array and values for each element.
4) Sorting the elements of each column in ascending order.
5) Sorting the elements of each row in ascending order.
6) Displaying the final array values.
Copyright:
Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online from Scribd
Dim m As Integer Dim n As Integer Dim i As Integer Dim j As Integer Dim k As Integer Private Sub cmdexit_Click() End End Sub__ ‘Thuû tuïc tìm vaø xuaát ra giaù trò lôùn nhaát cuûa töøng coät Private Sub cmdlc_Click() For j = 1 To n Max = a(1, j) For i = 2 To m If Max < a(i, j) Then Max = a(i, j) End If Next MsgBox " Gia tri lon nhat cua cot " & j & " la " & Max Next End Sub ‘Thuû tuïc tìm vaø xuaát ra giaù trò lôùn nhaát cuûa töøng doøng Private Sub cmdld_Click() For i = 1 To m Max = a(i, 1) For j = 2 To n If Max < a(i, j) Then Max = a(i, j) End If Next MsgBox "gia tri lom nhat dong " & i & " la" & " " & Max Next End Sub Private Sub cmdnhap_Click() Do m = InputBox("m=", "nhap so phan tu dong", 0) Loop While (m <= 0) Do n = InputBox("n=", "nhap so phan tu cot", 0) Loop While (n <= 0) ReDim a(m, n) As Integer For i = 1 To m For j = 1 To n a(i, j) = InputBox("a[" & i & "][" & j & "]=", "nhap gia tri cho phan tu") Next Next End Sub Private Sub cmdtc_Click() For j = 1 To n For i = 1 To m For k = i + 1 To m If a(i, j) > a(k, j) Then Call swap(a(i, j), a(k, j)) End If Next Next Next End Sub Private Sub cmdtd_Click() For i = 1 To m For j = 1 To n For k = j + 1 To n If a(i, j) > a(i, k) Then Call swap(a(i, j), a(i, k)) End If Next Next Next End Sub Private Sub cmdxuat_Click() Dim s As String For i = 1 To m For j = 1 To n s = s & Space(4) & a(i, j) Next s = s & vbCrLf Next MsgBox s End Sub Public Sub swap(ByRef a As Integer, ByRef b As Integer) Dim tmp As Integer tmp = a a=b b = tmp End Sub Baøi 2: thöïc hieän baûng tính sau: