Write a C# program that allows you to produce a table of values

Write a program that allows you to produce a table of Football or Hockey teams. The table should also include games played and points. Attempt this program with some argument passing. For higher grades attempt below procedure Improve the array by sorting it by points. For example, the team with the highest points should be at index 0.

Procedure:

  1. Go to File, New -> Project, select window Classic Desktop ->Console App (.net Framework).
  2. Console App created.
  3. Create a table and mention the column name in the table.
  4. Insert the value in the table.
  5. Sort value in DESC order by point.
  6. Code is given below.

C Sharp Program Code:

using System;
using System.Data;
class Program
{
static void Main()
{
string Player;        
using (DataTable table = new DataTable())
{            
table.Columns.Add("Player", typeof(string));
table.Columns.Add("Game", typeof(string));
table.Columns.Add("Points", typeof(int));
         
for(int i = 0; i < 3 ; i++)
{
Console.WriteLine("Enter the " +  (i+1) +  " player Information");
Player = Console.ReadLine();
string[] abc = Player.Split(' ');
int score = Convert.ToInt32(abc[2]);
table.Rows.Add(abc[0], abc[1], score);
}
DataView view = new DataView(table);
view.Sort = "Points DESC";
Console.WriteLine("\nRows in sorted order\n  \n");
foreach (DataRowView row in view)
{
Console.WriteLine(" {0} \t {1} \t {2} ", row["Player"], row["Game"], row["Points"]);
}
}
}
}

C Sharp Program Output:

Write a C# program that allows you to produce a table of values

Write My Essay Services