I have a problem that requires me to calculate synthetic student marks from a text file. It gives me the weights of the marks in the first row, the number of students to evaluate in the next row, and then the next rows are the students' marks. This pattern repeats through the file without major separation.
For clarity, the text file and problem are here:
I've tried making a new object with streamreader using the following code:
using (StreamReader sr = new StreamReader("DATA10.txt")) {
blahblahblah;
}
DATA10.txt is in the same folder as the program.
But I get "Cannot convert from 'string' to 'System.IO.Stream'", even though in the examples on MSDN and everywhere else use that exact code just fine. What am I doing wrong?
Eventually what I'll be doing is taking the value from the second line and using streamreader to read that amount of lines. Then repeating the whole process on the next set of data.
I really don't think it's a duplicate of that question, and the answers here are expressed in an easier to understand way.