题目内容

以下程序执行后,文件dataf.txt的内容是( )。int main(){ FILE *fp;int a=15,b=18;fp=fopen("dataf.txt","w");fprintf(fp,"%d ",a);fclose(fp);fp=fopen("dataf.txt","a");fprintf(fp,"%d ",b);fclose(fp);return 0;}

A. 15
B. 15 18
C. 18
D. 18 15

查看答案
更多问题

执行以下程序的输出结果是( )。int main(){FILE *fp;int a=15,b,c;a+=5;fp=fopen("dataf.txt","w");fprintf(fp,"%d ",a);fclose(fp);fp=fopen("dataf.txt","r");fscanf(fp,"%d ",&b);fclose(fp);c=a*b;printf("%d\n",c);}

A. 300
B. 400
C. 15
D. 20

以下程序执行后,文件data.txt的内容是( )。int main(){ FILE *fp;struct worker{ int n;float wt;}a;a.n=102;a.wt=68.5;fp=fopen("data.txt","w");fprintf(fp,"%d,%.1f\n",a.n,a.wt);fclose(fp);}

A. 170.5
B. 102,68.5
C. 102
D. 68.5

执行以下程序后,文件test.txt的内容是( )。#include int main(){ FILE *fp;char str[][10]={"hello","world"};fp = fopen("test.txt", "w");if(fp!=NULL)fprintf(fp,"%s",str[1]);fclose(fp);fp = fopen("test.txt", "w");if(fp!=NULL)fprintf(fp,"%s",str[0]);fclose(fp);return 0;}

A. world
B. hello
C. hello world
D. world hello

以下程序运行后,data.txt文件中的内容是( )。#include int main(){ FILE *fp;char str[]="GoodNight!";int i=0;fp=fopen("d:\\data.txt","w");while(i<4){ fprintf(fp,"%c",str[i]);i++;}fclose(fp);return 0;}

A. Night
B. GoodNight!
C. GoodN
D. Good

答案查题题库