本人想用C语言做个表,帮帮忙

来源:百度知道 编辑:UC知道 时间:2024/06/01 03:48:02
本人想用C语言做个小程序,就是关于学生成绩统计的:

语文 数学 总分 平均分
******************************************
学号 成绩 … 计算 计算
… …
******************************************

要求: 输入学号跟各科成绩 然后输出如上图的表(包括要计算出总分和平均分) 用for嵌套我比较好理解..

谢谢大家了.. 有效期:2007.10.24晚上9点前

#include <stdio.h>
#define MAX 50
struct few
{
float a;
float b;
float c;
};
struct student
{
int num;
char name[30];
float ave;
struct few score;
};
void display(int,char *,float);
void main()
{
struct student stu[MAX];
struct student temp;
struct student in;
int i=0,count=0,j,set=0,num;
float sum=0;
char ans;
ans='y';
do
{
printf("\n请入学号:");
scanf("%d",&stu[i].num);
printf("\n请输入姓名:");
fflush(stdin);
gets(stu[i].name);
printf("\n三门课的成绩:");
printf("\n成绩1:");
scanf("%f",&stu[i].score.a);
printf("\n成绩2:");
scanf("%f",&stu[i].score.b);
printf("\n成绩3:");
scanf("%f",&stu[i].score.c);
sum=stu[i].score.a+stu[i].score.b+stu[