我正在使用 C#,我想更改输出的视图。原始输出是这样的。
|---------------|---------------|-----------------|
| Student Name | Student Year | Student Teacher |
|---------------|---------------|-----------------|
| StudentName01 | Junior | Ms. Mandy |
| StudentName02 | Junior | Ms. Mandy |
| StudentName03 | Junior | Ms. Mandy |
| StudentName04 | Junior | Ms. Mandy |
| StudentName05 | Junior | Ms. Mandy |
| StudentName06 | Junior | Ms. Mandy |
| StudentName07 | Junior | Ms. Mandy |
| StudentName08 | Junior | Ms. Mandy |
| StudentName09 | Junior | Ms. Mandy |
| StudentName10 | Junior | Ms. Mandy |
|---------------|---------------|-----------------|
目标输出:
|---------------|---------------|-----------------|---------------|---------------|-----------------|
| Student Name | Student Year | Student Teacher | Student Name | Student Year | Student Teacher |
|---------------|---------------|-----------------|---------------|---------------|-----------------|
| Martha | Junior | Ms. Mandy | Barry | Junior | Ms. Mandy |
| Joseph | Junior | Ms. Mandy | Cathy | Junior | Ms. Mandy |
| Adam | Junior | Ms. Mandy | Elle | Junior | Ms. Mandy |
| Lyn | Junior | Ms. Mandy | Faye | Junior | Ms. Mandy |
| Drew | Junior | Ms. Mandy | Gary | Junior | Ms. Mandy |
|---------------|---------------|-----------------|---------------|---------------|-----------------|
电流输出:
|---------------|---------------|-----------------|---------------|---------------|-----------------|
| Student Name | Student Year | Student Teacher | Student Name | Student Year | Student Teacher |
|---------------|---------------|-----------------|---------------|---------------|-----------------|
| Martha | Junior | Ms. Mandy | | | |
| Joseph | Junior | Ms. Mandy | | | |
| Adam | Junior | Ms. Mandy | | | |
| Lyn | Junior | Ms. Mandy | | | |
| Drew | Junior | Ms. Mandy | | | |
| | | | Barry | Junior | Ms. Mandy |
| | | | Cathy | Junior | Ms. Mandy |
| | | | Elle | Junior | Ms. Mandy |
| | | | Faye | Junior | Ms. Mandy |
| | | | Gary | Junior | Ms. Mandy |
|---------------|---------------|-----------------|---------------|---------------|-----------------|
这是我的代码,我正在获取当前输出。我应该添加什么来获得目标输出?
CString temp;
int qtnt;
for (int i = 0 ; i <= Student_Max; i++)
{
StudentInfo[i].StudentLine1 = "Student Name";
StudentInfo[i].StudentLine1 = YEAR;
StudentInfo[i].StudentNo1 = -1;
StudentInfo[i].StudentLine2 = "Student Name";
StudentInfo[i].StudentLine2 = YEAR;
StudentInfo[i].StudentNo2 = -1;
if (qtnt = (Student_Max / 2)
{
int qtnt1 = qtnt;
int qtnt2 = qtnt1 + qtnt;
temp.Format("StudentName %d", i+1);
if (i < qtnt1)
{
StudentInfo[i].StudentLine1 = (new CString(temp))[0];
StudentInfo[i].StudentYear1 = STUDENTYEAR;
StudentInfo[i].StudentNo1 = i;
}
else if (i < qtnt2)
{
StudentInfo[i].StudentLine2 = (new CString(temp))[0];
StudentInfo[i].StudentLine2 = STUDENTYEAR;
StudentInfo[i].StudentNo2 = i;
}
}
}