I need to read the best grades from the Grades.txt file and save the best grades of individual students in the BestGrades.txt file. Unfortunately I can only view student data on the console. Could someone help me?
using System;
using System.IO;
namespace Projekt
{
class Program
{
static void Main(string[] args)
{
int counter = 0;
string line;
System.IO.StreamReader file =
new System.IO.StreamReader(@"C:\Users\eryks\Desktop\Grades.txt");
while ((line = file.ReadLine()) != null)
{
System.Console.WriteLine(line);
counter++;
}
file.Close();
}
}
}
Grades.txt:
1,Jan,Kowalski,Informatyka,5
2,Wiktoria,Prietz,Informatyka,6
3,Jakub,Mateja,Informatyka,3
id,name,lastname,school subject,grade