c语言程序 帮忙检查错在那里(选课,总分,平均分无法显示)

来源:百度知道 编辑:UC知道 时间:2024/05/22 07:07:44
#include<stdio.h>
#define STU_NUM 40
#define COURSE_NUM 10
struct student
{
int number;
char name[15],choose1,choose2;
int score[COURSE_NUM];
long sum;
float average;
};

typedef struct student STU;

void AppendScore(STU *head,int n,int m)
{
int j;
STU *p;
for(p=head;p<head+n;p++)
{
printf("\nInput number:");
scanf("%d",&p->number);
printf("Input name:");
scanf("%s",p->name);
printf("1 is English,2 is math\n");
printf("choice 1(y)or not(n)");
scanf("%s",p->choose1);
printf("choice 2(y)or not(n)");
scanf("%s",p->choose2);
for(j=0;j<m;j++)
{
printf("Input score%d:",j+1);
scanf("%d",p->score+j);
}
}
}

/*统计*/
void

#include<stdio.h>
/* 添加头文件 */
#include<string.h>
#include<stdlib.h>

#define STU_NUM 40
#define COURSE_NUM 10
struct student
{
int number;
char name[15],choose1,choose2;
int score[COURSE_NUM];
long sum;
float average;
};

typedef struct student STU;

void AppendScore(STU *head,int n,int m)
{
int j;
STU *p;
for(p=head;p<head+n;p++)
{
printf("\nInput number:");
scanf("%d",&p->number);
printf("Input name:");
scanf("%s",p->name);
printf("1 is English,2 is math\n");
printf("choice 1(y)or not(n)");
scanf("%s",p->choose1);
printf("choice 2(y)or not(n)");
scanf("%s",p->choose2);
for(j=0;j<m;j++)
{
printf("Input score%d:",j+1);
scanf("