填空题
下列程序的运行结果为。#include int main(void){FILE *fp;int i;char t, str[]="abcd";fp=fopen("abc.dat","wb+");for(i=0;i<4;i++)fwrite(&str[i],1,1,fp);fseek(fp,-3L,2);fread(&t,1,1,fp);fclose(fp);printf("%c\n",t);return 0;}
填空题
下列程序的运行结果为。#includeint main(void){FILE *fp;int i, k=0,n=0;fp=fopen("d1.dat","w");for(i=1;i<4;i++)fprintf(fp,"%d",++i);fclose(fp);fp=fopen("d1.dat","r");fscanf(fp,"%d",&k);printf("%d\n%d\n",k,n);fclose(fp);return 0;}
填空题
下列程序的运行结果为。#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;}
填空题
下列程序的运行结果为。#includeintmain(void){FILE*fp;inta[10]={11,22,33,44,55,66,77,88,99,100};intb[6],i;fp=fopen("test.dat","wb");fwrite(a,sizeof(int),10,fp);fclose(fp);fp=fopen("test.dat","rb");fread(b,sizeof(int),6,fp);fread(b+2,sizeof(int),4,fp);fclose(fp);for(i=0;i<6;i++)printf("%d",b[i]);return0;}
套餐购买该问题答案仅对会员开放,欢迎开通会员 ¥ 19.9
0.64/天
1个月(不限次)
¥ 19.9
1000次
(不限时)
¥ 29.9
0.32/天
3个月(不限次)
¥ 59.9
0.16/天
1年(不限次)
立即支付