这是我的代码:
我还想从数字的输入中获取一个数字,以获取多个名称,并在排序的最后按数字和在输出中输入的数字的名称进行排序。
我不允许使用课程。
int[] arr1 = new int[10];
string[] name = new string[10];
int n, i, j, tmp;
Console.Write("\n\nSort elements of array in ascending order :\n");
Console.Write("----------------------------------------------\n");
Console.Write("Input the size of array : ");
n = Convert.ToInt32(Console.ReadLine());
Console.Write("Input {0} elements in the array :\n", n);
for (i = 0; i < n; i++)
{
Console.WriteLine("Enter name {0}", i);
name[i] = Console.ReadLine();
Console.Write("element - {0} : ", i);
arr1[i] = Convert.ToInt32(Console.ReadLine());
}
for (i = 0; i < n; i++)
{
for (j = i + 1; j < n; j++)
{
if (arr1[j] < arr1[i])
{
tmp = arr1[i];
arr1[i] = arr1[j];
arr1[j] = tmp;
}
}
}
Console.Write("\nElements of array in sorted ascending order:\n");
for (i = 0; i < n; i++)
{
Console.Write("{0}, {1} ", arr1[i],name[i]);
}
Console.Write("\n\n");
Console.ReadLine();
答案 0 :(得分:0)
如果可以使用列表类型,则可以尝试以下代码:
mysql: macOS Sierra or newer is required.
Error: An unsatisfied requirement failed this build.