第1个回答 2012-07-20
#include<stdio.h>
#define N 2
struct student
{
int num;
char name[20];
float score[3];
}stu[N]={{1001,"chen",98,87,67},{1002,"jian",78,90,56}};
void main()
{
float f(float *p);
int j;
float t;
for(j=0;j<3;j++)
{
t=f(&stu[0].score[j]);
printf("%5.3f\n",t/N);
}
}
float f(float *p)
{
float temp=0;
int i;
for(i=0;i<N;i++,p++) temp=temp+*p;
printf("%-5.0f ",temp);
return(temp);
}
这个是这样的本回答被网友采纳
第2个回答 2012-07-20
#include<stdio.h>
#define N 2
struct student
{
int num;
char name[20];
float score[3];
}stu[N]={{1001,"chen",98,87,67},{1002,"jian",78,90,56}};
void main()
{
float f(float *p);
int j;
float t;
for(j=0;j<3;j++)
{
t=f(&stu[0].score[j]);
printf("%5.3f\n",t/N);
}
}
float f(float *p)
{
float temp=0;
int i;
for(i=0;i<N;i++,p++) temp=temp+*p;
printf("%-5.0f ",temp);
return(temp);
}
第3个回答 2012-07-20
下面的代码是什么意思?
是有bug 还是要别人给你写呢?