运行时没有错,但出不来结果,帮帮忙,谢了,星期三就要交了,

[复制链接]
查看11 | 回复1 | 2010-12-20 22:02:25 | 显示全部楼层 |阅读模式
#include
#include
#define M 2
#define N 3
void input();
float average();
struct stu
{
int num;
char *name[10];
int score[3];
int total;
float ave;
};
struct stu s[M];
main()
{
struct stu s[M];
int i,m;
float a;
printf("\nPlease input student's information.\n");
printf("NO. name score1 score2 score3 total average");
printf("\n");
input(s[M]);
a=average(s[M]);
m=maximum(s[M]);
printf("
NO.
namescore1score2score3 total average\n");
for(i=0;i#include#define M 2#define N 3void input();float average();struct stu{ int num; char name[10]; int score[3]; int total; int ave;};struct stu s[M];void input(struct stu s[M]){ int i; for(i=0;i<M;i++) scanf("%8d%8s%8d%8d%8d",&s.num,s.name,&s.score[0],&s.s
回复

使用道具 举报

千问 | 2010-12-20 22:02:25 | 显示全部楼层
函数声明不对,应该是
float
average(struct stu s[M])
void input(struct stu s[M])M可有可无。结构体struct stu{int num;char *name[10];int score[3];int total;float ave;};那个c
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行