Private aQuestions(4, 4) As String
Private aCorrectQuestions(4, 1) As String
Dim sFileQuestions As String = "D:\Files\rivers.txt"
Dim sFileAnswers As String = "D:\Files\answer.txt"
Dim sFileCorrect As String = "D:\Files\riverlengths.txt"
Dim sr As New StreamReader(sFileQuestions)
aQuestions(n, i) = aQuestions(n, i) & sr.ReadLine()
Console.Write(aQuestions(i, 0) & " River , ")
Console.Write(aQuestions(i, n) & " ")
Dim aAnswers(4) As Integer
Dim oSr As New StreamReader(sFileAnswers)
Do While oSr.Peek() <> -1
aAnswers(n) = aAnswers(n) & oSr.ReadLine() & vbNewLine
Console.WriteLine(aQuestions(n, 0) & " river" & " is " & aQuestions(n, aAnswers(n)) & "km long")
Using sw As StreamWriter = File.AppendText(sFileCorrect)
sw.WriteLine(aQuestions(n, 0) & vbCrLf & aQuestions(n, aAnswers(n)))
Dim lsr As New StreamReader(sFileCorrect)
Do While lsr.Peek() <> -1
aCorrectQuestions(n, i) = aCorrectQuestions(n, i) & lsr.ReadLine()
Dim lastUnsortedPos As Integer
lastUnsortedPos = lastUnsortedPos - 1
For j = 0 To lastUnsortedPos
If aCorrectQuestions(j, 0) > aCorrectQuestions(j + 1, 0) Then
temp = aCorrectQuestions(j, 0)
aCorrectQuestions(j, 0) = aCorrectQuestions(j + 1, 0)
aCorrectQuestions(j + 1, 0) = temp
Console.WriteLine("Array Sorted Alphabetically :")
Console.WriteLine(aQuestions(n, 0) & " river" & " is " & aQuestions(n, aAnswers(n)) & "km long")