I have a csv file that has 30 rows and 5 columns. I have this read into my application using stream reader, then put into an array, sorted, now being written out to the file. I have 5 columns that show "Score" followed with dashes beneath. My problem is I need to output my array in 5 columns after its sorted. I have a for loop that iterates through the length of the array. I really need it to iterate 30 lines and 5 columns, but I'm not sure how to do that. I apologize, but I am new to C# and features such as linq. Here is a short version of my output and the for loop. Let me know if further clarification is needed.
int n;
fileOut.WriteLine();
fileOut.WriteLine("Score Score Score Score Score");
fileOut.WriteLine("----- ----- ----- ----- -----");
for (n = 1; n <= numOfScores; n++)
fileOut.WriteLine("{0,4:f}", scoreArray[n]);
fileOut.WriteLine();
I know there has to be an easy way to do this, just not sure.
The current output looks like:
Score Score Score Score Score
----- ----- ----- ----- -----
97.05
96.52
93.16
92.44
91.05
90.66
90.59
//etc, etc, through entire array, only one line when it needs to be in each column.
Thanks, Joe