所以我的代码遇到了一些麻烦。对于初学者,我遇到了输出所有数组的问题。请注意,我只编码了 12 天,由于我所在大学的学习前景,我的老师在某种程度上跳过了 C# 编码的基础知识。而且我刚刚了解到它不会按字母顺序排列它们......
static int inputPartInformation(string[] pl)
{
int i = 0;
do
{
Console.Write("Enter a Name: ");
//for the player
pl[i] = Console.ReadLine();
}
while (pl[i++].CompareTo("Q") != 0);
//if they write Q for the player it will quit
return i - 1;
}
static void Main(string[] args)
{
String[] players = new String[100];
Array.Sort(players);
// Sort array.
//defines players in this new instance
var count = inputPartInformation(players);
//for the portion of the code that handles the input
//calculates the average score
Console.WriteLine("List of People in Order: {0}, {1}, {2}, {3}, {4}, {5}, {6},", players);
Console.ReadLine();
}
}
}