scanf("%f,&f;)
if((____)==NULL)
{printf("Can'topenfile\n");exit(0);}
fseek(fp,4*sizeof(float) - 高级语言程序设计(一)(00342) - 专业知识收录平台">
scanf("%f,&f;)
if((____)==NULL)
{printf("Can'topenfile\n");exit(0);}
fseek(fp,4*sizeof(float) - 高级语言程序设计(一)(00342) - 专业知识收录平台">
下列程序用来建立一个随机文件f1.dat,将键盘输入的一个浮点数f写入第5条记录。请填空。
#include
main()
{floatf;
FILE*fp;
printf("\ninputafloatnumber:");
scanf("%f,&f;)
if((____)==NULL)
{printf("Can'topenfile\n");exit(0);}
fseek(fp,4*sizeof(float),SEEK_SET)
if(____!=1)
printf("filewriteerror.\n");
fclose(fo);
}
填空内容为打开文件和向文件中写入数据。 fp=fopen("f1.dat","wb") fwrite(&f,4*sizeof(float),l,fp)
扫描二维码免费使用微信小程序搜题/刷题/查看解析。
版权声明:本文由翰林刷题小程序授权发布,如需转载请注明出处。