我想创建一个程序来获取学生的姓名和他们在 2 个科目中的分数,并以表格格式显示它们,我使用的是锯齿状数组,如果我只显示标记它工作得很好,但我也想包括学生的名字显示的信息,下面是我的代码。
public void GetSquareArray()
{
const int STUDENTS = 1;
const int MARKS = 2;
string[] numbers = { "First", "Second", "Third", "Fourth", "Fifth" };
string[][] company_details = new string[STUDENTS][];
for (int i = 0; i < STUDENTS; i++)
{
company_details[i] = new string[MARKS];
/*Console.WriteLine("Enter {0} Student Name", numbers[i]);
company_details[i][0] = Console.ReadLine();*/ commenting this works fine
for (int j = 0; j < MARKS; j++)
{
Console.WriteLine("Enter Marks {0}:", j + 1);
company_details[i][j] = Console.ReadLine();
}
}
for (int x = 0; x < STUDENTS; x++)
{
/*Console.Write("STUDENTS {0}: ", company_details[x]);*/ commenting this works fine.
for (int y = 0; y < MARKS; y++)
{
Console.Write("{0}\t", company_details[x][y]);
}
Console.WriteLine("");
}
}
谁能告诉我如何在显示的信息中包含学生信息(姓名),就像它应该显示的一样
Abbas: 12 12