You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
// 函数功能:按学号查找学生成绩并显示查找结果
|
|
|
|
void SearchbyNum(STU stu[], int n, int m)
|
|
|
|
{
|
|
|
|
long number;
|
|
|
|
int i, j;
|
|
|
|
printf("Input the number you want to search:");
|
|
|
|
scanf("%ld", &number);
|
|
|
|
|
|
|
|
/* ---------- begain ---------- */
|
|
|
|
for(i=0;i<n;i++)
|
|
|
|
{
|
|
|
|
if (stu[i].num==number)
|
|
|
|
{
|
|
|
|
printf("%ld\t%s\t", stu[i].num, stu[i].name);
|
|
|
|
for (j=0; j<m; j++)
|
|
|
|
{
|
|
|
|
printf("%.0f\t", stu[i].score[j]);
|
|
|
|
}
|
|
|
|
printf("%.0f\t%.0f\n", stu[i].sum, stu[i].aver);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ----------- end ----------- */
|
|
|
|
|
|
|
|
printf("\nNot found!\n");
|
|
|
|
}
|
|
|
|
}
|