有以下程序,程序运行后,文件t1.dat 中的内容是 #include void WriteStr(char *fn,char *str){ FILE *fp;fp=fopen(fn,"w"); fputs(str,fp); fclose(fp);}int main( ){ WriteStr("t1.dat","start");WriteStr("t1.dat","end"); return 0;}
A. start
B. end
C. startend
D. endrt
有以下程序,程序运行后的输出结果是 #include “stdio.h”int main(){FILE *fp;int k,n,a[6]={1,2,3,4,5,6};fp=fopen(“d2.dat”,”w”);fprintf(fp,”%d%d%d\n”,a[0],a[1],a[2]);fprintf(fp,”%d%d%d\n”,a[3],a[4],a[5]);fclose(fp);fp=fopen(“da2.dat”,”r”);fscanf(fp,”%d%d”,&k,&n);printf(“%d%d\n”,k,n);fclose(fp);return 0;}
A. 1 2
B. 1 4
C. 123 4
D. 123 456
有以下程序,程序运行后的输出结果是 ___ #include main(){ FILE *fp; int k,n,i,a[6]={1,2,3,4,5,6}; fp=fopen("d2.dat","w"); for(i=0;i<6;i++) fprintf(fp, "%d,",a[i]); fclose(fp); fp=fopen("d2.dat","r"); for(i=0;i<3;i++) fscanf(fp, "%d,%d",&k,&n); fclose(fp); printf("%d,%d\n",k,n);}
A. 1,2
B. 3,4
C. 5,6
D. 123,456
有以下程序,若文本文件f1.txt中原有内容为:good,则运行以下程序后,文件f1.txt中内容为 #include main( ){ FILE*fp1;fp1=fopen(“f1.txt", "w");fprintf(fp1,"abc");fclose(fp1);}
A. goodabc
B. abcd
C. abc
D. abcgood