麻烦各位大神帮忙用C语言或C++编下这个程序,要源代码,老师交作业要,谢谢啦

30名学生,3门科目

少年,作业是用来回顾完善所学的知识的,而不是用来抄的。。。下面给出这个作业的核心代码,仅供参考
# include <stdio.h>
# include <stdlib.h>
# include <string.h>

typedef struct student
{
char name[50];
int mathScore;
int englishScore;
}STU;

void inputScore(STU * stu)
{

}

int average(STU * stu)
{

}

void sort(STU * stu)
{

}

int main(void)
{

return 0;
}
温馨提示:答案为网友推荐,仅供参考
第1个回答  2013-10-11
void main()
{
float * KC1Core;
float * KC2Core;
float * KC3Core;
KC1Core=(float *)malloc(30);
KC2Core=(float *)malloc(30);
KC3Core=(float *)malloc(30);
InputCore(KC1Core,KC2Core,KC3Core);
OutputStuCore(KC1Core,KC2Core,KC3Core);
OutputSingKC(KC1Core,KC2Core,KC3Core);
OutputAllStuCore(KC1Core,KC2Core,KC3Core);
}
void InputCore(float * KC1,float * KC2,float *KC3)
{
int i=0;
float temp;
while(i<30)
{
scanf("%f",&temp);
KC1[i]=temp;
scanf("%f",&temp);
KC2[i]=temp;
scanf("%f",&temp);
KC3[i]=temp;
i++;
}
return ;
}
void OutputStuCore(float * KC1,float * KC2,float *KC3)
{
int i=0;
for(i=0;i<30;i++)
{
printf("学生的平均成绩:%f",(KC1[i]+KC2[i]+KC3[i])/3);
}
}

void OutputSingKC(float * KC1,float * KC2,float *KC3)
{
int i=0;
float sum=0;
for(i=0;i<30;i++)
{
sum+=KC1[i];
}
printf(“各门课平均成绩:%f",sum/30);
sum=0;
for(i=0;i<30;i++)
{
sum+=KC2[i];
}
printf(“各门课平均成绩:%f",sum/30);
sum=0;
for(i=0;i<30;i++)
{
sum+=KC3[i];
}
printf(“各门课平均成绩:%f",sum/30);
}
void OutputAllStuCore(float * KC1,float * KC2,float *KC3)
{
int i=0;
float max=0;
int j=0;
for(i=0;i<30;i++)
{
KC1[i]+=KC2[i]+KC3[i];
KC1[i]/=3;
}
i=30;
while(i>0)
{
max=-1;
for(j=0;j<30;j++)
{
if(KC1[j]>max)
{
max=KC1;
}
}
for(j=0;j<30;j++)
{
if(KC1[j]==max)
{
prntif("%d",max);
KC1[j]=-1;
}
}
i=0;
for(j=0;j<30;j++)
{
if(KC1[j] >=0)
{
i++;
}
}
}
}
第2个回答  2013-10-12
用数组还是链表?
相似回答