Search
 
 

Display results as :
 


Rechercher Advanced Search

Latest topics
» NewBlueFx TotalFX Windows-FL | 1.11 GB
Tue Dec 17, 2013 12:42 pm by titquarra

» NewBlueFx TotalFX Windows-FL | 1.11 GB
Tue Dec 17, 2013 12:42 pm by titquarra

» Celebrity.Sex.Tape.UNCUT.&.UNRATED.2012.720p.BRrip.x264.YIFY.mp4
Tue Dec 17, 2013 8:32 am by titquarra

» Maya Autodesk Personal Learning Edition 8.5
Tue Dec 17, 2013 7:47 am by titquarra

» Tuyệt Kỹ Đong Giai Chân Kinh (tuyệt Kỹ cua trai)
Thu Aug 23, 2012 5:38 am by Admin

» Tuyệt kỹ cua giai
Thu Aug 23, 2012 5:36 am by Admin

» NETCAT.........
Mon Aug 13, 2012 6:35 am by Admin

» Bảo mật CSDL bằng phương pháp mã hóa.
Tue Apr 17, 2012 10:04 pm by Admin

» Hàm mã hóa MD5 bằng JavaScript
Tue Apr 17, 2012 10:03 pm by Admin

Shopmotion


Affiliates
free forum


Thao tac tren mang mot chieu

View previous topic View next topic Go down

Thao tac tren mang mot chieu

Post  Admin on Sat Jan 15, 2011 1:20 am

Code:
Imports System.Console
Module Module1
    Sub nhap(ByRef a() As Integer, ByVal n As Integer)
        Dim s As String
        For i = 0 To n - 1
            Write("Nhap phan tu thu[" & CStr(i) & "]: ")
            s = ReadLine()
            a(i) = Integer.Parse(s)
        Next
    End Sub
    Sub xuat(ByVal a() As Integer, ByVal n As Integer)
        For i = 0 To n - 1
            Write(a(i) & " ")
        Next
    End Sub
    Function tongmang(ByVal a() As Integer, ByVal n As Integer) As Integer
        Dim tong As Integer = 0
        For i = 0 To n - 1
            tong = tong + a(i)
        Next
        Return tong
    End Function
    Sub sort(ByVal a() As Integer, ByVal n As Integer)
        For i = 1 To n - 1 Step 1
            For j = n - 1 To i Step -1
                If (a(j - 1) > a(j)) Then
                    Dim tmp As Integer
                    tmp = a(j - 1)
                    a(j - 1) = a(j)
                    a(j) = tmp
                End If
            Next
        Next
    End Sub

    Sub Main()
        Dim a(30) As Integer
        Dim n As Integer
        Write("Nhap so phan tu cua mang: ")
        n = ReadLine()
        nhap(a, n)
        xuat(a, n)
        WriteLine()
        WriteLine(CStr(tongmang(a, n)))
        sort(a, n)
        xuat(a, n)
        ReadKey()
    End Sub
End Module








Admin
Admin

Tổng số bài gửi : 782
Join date : 2009-08-15

View user profile http://hackis.forumotion.com

Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum