Cx330_按学号查找学生成绩并显示查找结果

Cx330_按学号查找学生成绩并显示查找结果
Cx330 2 years ago
parent 3362254958
commit 4be591b3eb

@ -249,7 +249,21 @@ void SortbyName(STU stu[],int n,int m)
``` ```
void SearchbyNum(STU stu[],int n,int m) void SearchbyNum(STU stu[],int n,int m)
{ {
long number;
int i,j;
printf("Input the number you want to search:");
scanf("%ld",&number);
for(i=0;i<n;i++)
if(stu[i].num==number)
{
printf("\n");
for(j=0;j<m;j++)
printf("%d\t",stu[i].score[j]);
printf("\n");
break;
}
if(i==n)
printf("\nNot found!\n");
} }
``` ```

Loading…
Cancel
Save