Professional Documents
Culture Documents
Bubble Sort 2022
Bubble Sort 2022
End If
Next j
Next x
For x = 0 To 6
Console.WriteLine(mylist(x))
Next
Console.ReadKey()
Sub Main()
Dim mylist() As Integer = {25, 34, 98, 7, 41, 19, 5}
Dim n, j, temp As Integer
Dim maxindex As Integer = 6
Dim nomoreswaps As Boolean
n = maxindex - 1
Do
nomoreswaps = True
For j = 0 To n
If mylist(j) > mylist(j + 1) Then
temp = mylist(j )
mylist(j) = mylist(j + 1)
mylist(j + 1) = temp
nomoreswaps = False
End If
Next j
n = n - 1
Loop Until nomoreswaps = True
For x = 0 To 6
Console.WriteLine(mylist(x))
Next
Console.ReadKey()
Read
Write
Dim name, age, sect As String
Dim filehandle As New IO.StreamWriter("c:\users\ratta\desktop\abc.txt")
Console.WriteLine("ënter age")
age = Console.ReadLine
While age <> "-1"
Console.WriteLine("enter name")
name = Console.ReadLine
Console.WriteLine("enter sect")
sect = Console.ReadLine
filehandle.WriteLine(name & ":" & age & ":" & sect)
Console.WriteLine("enter age")
age = Console.ReadLine
End While
filehandle.Close()