1.题目
本实例实现在窗体上输入学生序号,将在窗体上输出该序号对应的学生的成绩。
2.代码
#include<stdio.h>
float* search(float(*p)[4], int n)
{
float* pt;
pt = *(p + n);
return (pt);
}
int main(void)
{
float score[][4] = { {85,65,75,99} ,{75,32,64,85} ,{51,77,66,93},{78,95,88,91} };
float* p;
int j;
printf("输入你要查询的学生编号:");
scanf("%d", &j);
printf("该生的成绩为:\n");
p = search(score, j);
for (int i = 0; i < 4; i++)
{
printf("%5.1f\t", *(p + i));
}
printf("\n");
}
3.输出结果截图

本文介绍了一个使用C语言实现的学生成绩查询系统。通过输入学生序号,系统将返回对应学生的四门课程成绩。代码中使用了指针函数来实现成绩的检索。
2003

被折叠的 条评论
为什么被折叠?



