一个小小的疑惑^^
请各位高手帮我看看下面这个程序:/* 学生信息录入*/
#include "stdio.h"
struct student
{ int num;
char name[20];
char sex;
int age;
float score[3];
float total;
float ave;
};
/*-----------------------------------------------*/
main()
{
void count(struct student a[],int i);
struct student a[3];
int i;
for(i=0;i<3;i++)
scanf("%d %s %c %d %f %f %f",
&a[i].num,a[i].name,&a[i].sex,&a[i].age,&a[i].score[0],&a[i].score[1],&a[i].score[2]);
count(a,3);
}
/*----------------------------------------------*/
void count(struct student b[],int n)
{
int i,j;
for(i=0;i<n;i++)
{b[i].total=0;
for(j=0;j<3;j++)
b[i].total=b[i].total+b[i].score[j];
b[i].ave=b[i].total/3;
}
printf("NO name sex age s(0) s(1) s(2) total ave \n");
for(i=0;i<3;i++)
printf("%d %s %c %d %3.1f %3.1f %3.1f %3.1f %3.1f\n",
b[i].num,b[i].name,b[i].sex,b[i].age,b[i].score[0],b[i].score[1],b[i].score[2],b[i].total,b[i].ave);
}
不是我编的,是我从谭浩强的C语言习题集与上机指导中敲入的(p113),编译器是turbo C ,运行的时候会出现
scanf:floating point formats not linked abnormal program termination
的字样,不能再次录入数据,小弟不懂,盼望赐教!