题目内容
下列程序的运行结果为。#include#includeint main(void){FILE *fp;float sum=0.0,x;int i;float y[4]={-12.1,13.2,-14.3,15.4};if((fp=fopen("data1.dat","wb"))==NULL)exit(0);for(i=0; i<4; i++)fwrite(&y[i],4,1,fp);fclose(fp);if((fp=fopen("data1.dat","rb"))==NULL)exit(0);for(i=0;i<4;i++,i++){fread(&x,4,1,fp);sum+=x;}printf("sum=%.1f\n",sum);fclose(fp);return 0;}
查看答案
搜索结果不匹配?点我反馈
更多问题