void main()
{ int n,fahr,hot,comfort,cold;
double total,ave ;
FILE *fp;
if((fp=___fopen____ ("data.txt","r"))==NULL) //以读方式打开数据文件
{ printf("can not open file!");
exit(0);
}
hot=comfort=cold=0;
total=0; n=0;
while(!feof(fp)) //当文件未读完时
{ //从文件中读入华氏温度 fahr
___fscanf____ (fp,"%d",&fahr);
total=___total____+fahr;
n++;
if(fahr>=90)
hot++;
else if (fahr>=50)
comfort++ ;
else
cold++;
}
ave= total/n ;
printf("hot=%d, comfort =%d,cold =%d, average =%f",hot,comfort,cold,ave);
fclose(___fp____);
}
#include
求采纳为满意回答。