I am trying to make a vb program that reads a text file and manipulated the data within.
For instance, my text file contains the following information:
27
rt
3
+
5
*
2
/
2
^
3
This is all the information my text file contains. I am trying to read the first line, store the line into a variable of some sort, read the next two lines and operate them against the first, then store as a variable and then loop until it goes through all the math involved and then displays the output of 8. ( 27 rt 3 = 3 | 3 + 5 = 8 | 8 * 2 = 16 | 16 / 4 = 4 | 4 - 2 = 2 | 2 ^ 3 = 8 )
Now, The code i have i can get it to read through the document. My code is as follows:
Imports System.IO
Module Module1
Sub Main()
Dim list As New List(Of String)
Using r As StreamReader = New StreamReader("c:\myMathProblem.txt")
Dim line As String
line = r.ReadLine
Do While (Not line Is Nothing)
list.Add(line)
Console.WriteLine(line)
line = r.ReadLine
Loop
End Using
End Sub
End Module
This runs through the entire document prints the whole document then exit. I cant figure out how to slow it down store the lines as variable so i can operate against them. Any help will be appreciated.