请高手帮忙编写C语言程序,万分感谢!!

编写下面C语言程序,在计算机上完成程序输入、编译、连接、运行,并且完成实验报告的撰写。
一个文本文件中存放着NBA火箭队员姚明的信息。每一行的数据及其含义是这样排列的(每一行数据均为场均值):

赛季 出场 时间 总篮板 助攻 盖帽 犯规 得分
08-09 77 33.6 9.9 1.8 1.9 3.3 19.7
07-08 55 37.2 10.8 2.3 2 3.1 22
06-07 48 33.8 9.4 2 2 3.3 25
05-06 57 34.2 10.2 1.5 1.6 3.4 22.3
04-05 80 30.6 8.4 0.8 2 3.7 18.3
03-04 82 32.8 9 1.5 1.9 3.3 17.5
02-03 82 29 8.2 1.7 1.8 2.8 13.5

写一个程序,把这些数据存储到一个结构体数组中。程序应该读到文件末尾,并且应该在最后保存姚明每一项的职业生涯统计数据。例如,要计算姚明职业生涯中的平均每场篮板数,就不能只是简单地将总篮板列的数据相加求平均,那会得到一个错误的数值9.4,而应该将每个赛季的出场次数乘以该赛季的总篮板数,求和之后再用总出场次数去除才能得到正确结果9.3。最后结果保留小数点后1位。职业生涯的统计数据附加在最后一行,程序运行结束后打开该文本文件检查内容是否完整。

各个细节就不加说明了,因为你题目已经说了;本人是正在学C语言,为了帮你编这个程序用了1个小时左右,希望多多支持一下,如果发现有什么错误的地方,请留言;谢谢
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#include<stdio.h>
void input(float *p,int n)
{
float a[n];
int i;
for(i=0;i<n;i++)
{
*(p+i)=&(a+i);
}
}
void output(float *p,int n)
{
int i;
float a[n+1];
*p=a[0];
for(i=0;i<n+1;i++)
return(*(p+i));
}
void sort(float *p,int n,char style)
{
int i;
float t,a[n];
*p=a[0];
for(i=0;i<n;i++)
{
if(style=='a')
{
if(*(p+i-1)>*(p+i))
{
t=*(p+i-1);
*(p+i-1)=*(p+i);
*(p+i)=t;
}
}
else if(style=='d')
{
if(*(p+i-1)<*(p+i))
{
t=*(p+i-1);
*(p+i-1)=*(p+i);
*(p+i)=t;
}
}

}
void insert(float *p,int n,float x)
{
int i;
float a[n],t;
*p=a[0];
for(i=0;i<n+1;i++)
{
if(*(p+i-1)>*(p+i))
{
if(*(p+n+1)>*(p+i))
{
t=*(p+n+1);
*(p+n+1)=*(p+i);
*(p+i)=t;
}
}
else if(*(p+n+1)<*(p+i))
{
t=*(p+n+1);
*(p+n+1)=*(p+i);
*(p+i)=t;
}
}
int seek(float *p,int n,float x)
{
int i;
float a[n],t;
*p=a[0];
for(i=0;i<n;i++)
{
if(*(p+i)==x)
{
printf("the char in the this:%d",i);
}
else
{
*(p+n+1)=x;
}
}
void insert(*p,n,x);
}
void main()
{float stu[11],x; /* 定义保存成绩的数组 */
char sortch;int n;
puts("Please input 10 score:");
input(stu,10); /* 调用函数实现成绩键盘输入 */
getchar(); /* 消化数据输入最后的回车符 */
printf("Please input sort style:");
sortch=getchar(); /* 接收排序字符 */

sort(stu,10,sortch); /* 调用函数对成绩排序 */
puts("=============after sort output==============");
output(stu,10); /* 输出排序后的10个成绩 */

puts("Please input another score:");
scanf("%f",&x); /* 输入一个要插入的新成绩 */
n=seek(stu,10,x);
if(n==-1)
printf("No find &f\n",x);
else insert(stu,10,x); /* 调用函数将x插入到数组stu中,使数组依然有序 */
puts("============ after insert====================");
output(stu,11);
}
温馨提示:答案为网友推荐,仅供参考
第1个回答  2011-01-12
期待答案……
相似回答