I have a text file like this:
Williams,Leonard Freshman 1.85
Smith,Sheila Senior 2.99
Anderson,Andy Sophomore 3.01
and i want to read those names and their year and numbers into a 3 arrays and then show them on the screen, but it only shows the first name, can anyone help with looping through all the names
The big issue you have is that every time you call the Read function in your i loop, you end up re-opening the list.txt file. This means that every time Read is called, it grabs values from the beginning of the file, hence only getting the details of the first name over & over again.
You only want to open the file once, outside of your i loop.
You also should close the file after your i loop.
And inside your i loop, you should be checking whether you have reached the end of the file (for example, by querying the result of inputFile.good() ). You want to stop reading from the file if you reach the end of it.
You could also use adding some bomb-proofing to the file opening & reading, but the above things should get you going in the right direction.