Hi! please help, how am i going to sort the notepad file that i read using streamReader?
Like for exaxmple the file goes like this:
smith, 96
williams, 98
Davis, 64
then the output when the option is in ascending order.
Surname: Grade:
Davis 64
Smith 96
Williams 98
how am i going to read each file and sort them when they are sepparated with commas?
Loading
VulpesPosted Mar 3, 2012, 6:32 AM
Sam HobbsPosted Mar 3, 2012, 6:34 AM
Sam HobbsPosted Mar 3, 2012, 6:33 AM
The file you are asking about is a Comma Separated Value (CSV) file. There are a few articles in this web site about CSV files; I wrote one of them.
What I would do is to start by writing a program that opens the file using StreamReader then uses the StreamReader.ReadLine Method to read each line until the end of the file. I would just write each input record to the console. That way I know I have that much working. I truly do do things like that to get started on something. Then you could solve the problem of how to split each line into Surname and Grade. Then I would figure out how to format the data.
So there are at least three separate tasks. Solve the problem buy doing each one separately. There are plenty of samples and articles to help you with use of the StreamReader class.