I'm very new to C# and I need your help. I have a file named myData.txt with the following data in it.
Johnson 85 83 77 91 100 Aniston 80 90 95 93 48 Chen 78 81 11 90 73 Gupta 92 83 30 69 87 Blair 23 45 96 38 59 Lamah 100 100 100 100 100
The first three scores are 'Assignments' and the last two scores are 'Exams'. All the names should go into a 1-dimensional array Assignments into a 2-dim array also Exams into a 2-dim array
My ultimate aim is to find out the average of assignments & exams for each student.Answer1:
This is a homework assignment, so I'll just give you hints:<ol><li>You can use StreamReader to open the file: <a href="http://msdn.microsoft.com/en-us/library/system.io.streamreader.aspx" rel="nofollow">StreamReader</a></li> <li>Looks like each line ends with a new line. You can loop through the file and read each line via StreamReader's ReadLine method: <a href="http://msdn.microsoft.com/en-us/library/system.io.streamreader.readline.aspx" rel="nofollow">ReadLine</a></li> <li>It looks like each line is delimited by tab. You can split the string returned by ReadLine on tab by using String's split method: <a href="http://msdn.microsoft.com/en-us/library/system.string.split.aspx" rel="nofollow">Split</a>. The char code for tab is '\t'. Splitting the string will put it into an array.</li> <li>Convert the scores to a number, add, and then divide at the end to get the mean.</li> </ol>