( 40 )有以下程序#include stdio.hmain (){ FILE *fp;char str[10];fp=fopen ( " myfile.dat " , " w " ) ;fputs ( " abc " ,fp ) ;fclose ( fp ) ;fpfopen ( " myfile.dat:, " a+ " ) ;fprintf ( fp, " %d " ,28 ) ;rewind ( fp ) ;fscanf ( fp, " %s " ,str ) ; puts ( str ) ;fclose ( fp ) ;}程序运行后的输出结果是A ) abcB ) 28cC ) abc28D )因类型不一致而出错

( 40 )有以下程序

#include <stdio.h>

main ()

{ FILE *fp;char str[10];

fp=fopen ( " myfile.dat " , " w " ) ;

fputs ( " abc " ,fp ) ;fclose ( fp ) ;

fpfopen ( " myfile.dat:, " a+ " ) ;

fprintf ( fp, " %d " ,28 ) ;

rewind ( fp ) ;

fscanf ( fp, " %s " ,str ) ; puts ( str ) ;

fclose ( fp ) ;

}

程序运行后的输出结果是

A ) abc

B ) 28c

C ) abc28

D )因类型不一致而出错


相关考题:

( 40 )有以下程序#include stdio.hmain (){ FILE *fp;char str[10];fp=fopen ( " myfile.dat " , " w " ) ;fputs ( " abc " ,fp ) ;fclose ( fp ) ;fpfopen ( " myfile.dat:, " a+ " ) ;fprintf ( fp, " %d " ,28 ) ;rewind ( fp ) ;fscanf ( fp, " %s " ,str ) ; puts ( str ) ;fclose ( fp ) ;}程序运行后的输出结果是A ) abcB ) 28cC ) abc28D )因类型不一致而出错

以下程序是建立一个名为myfile的文件,并把从键盘输入的字符存入该文件,当键盘上输入结束时关闭该文件。 include main { FILE *fp; char c; fp=__________; do { c=getchar; fputs(c,fp); }while(c!=EOF); __________; ; }

有以下程序includemain(){FILE*fp;inta[10]={1,2,3},i,n;fp=fopen("d1.daf","w");for( 有以下程序 #include <stdio.h> main() {FILE *fp; int a[10]={1,2,3},i,n; fp=fopen("d1.daf","w"); for(i=0;i<3;i++) fprintf(fp,"%d",a[i]); fprintf(fp,"\n"); fclose(fp); fp=fopen("d1.dat","r"); fscanf(fp,"%d",n); fclose(fp);A.12300B.123C.1D.321

有以下程序 include main(){FILE *fp;int i; char ch[]="abcd",t; fp=fopen("abc.dat" 有以下程序 #include <stdio.h> main() {FILE *fp; int i; char ch[]="abcd",t; fp=fopen("abc.dat","wb++"); for(i=O;i<4;i++)fwrite(ch[i],1,1,fp); fseek (fp,-2L,SEEK_END); fread (t,1,1,fp); fclose (fp); printf ("%c\n",t); } 程序执行后的输出结果是______。A.dB.cC.bD.a

有下列程序: include main() { FILE *fp; int a[10]={1,2,3},i,n; 有下列程序: #include <stdio.h> main() { FILE *fp; int a[10]={1,2,3},i,n; fp=fopen("d1.dat","w"); for(i=0;i<3;i++) fprintf(fp,"%d",a[i]); fprintf(fp,"\n"); fclose(fp); fp=open("d1.dat","r"); fscanf(fp,"%d",n); fclose(fp); prinff("%d\n",n); 程序的运行结果是( )。A.12300B.123C.1D.321

给定程序的功能是:从键盘输入若干行文本(每行不超过80个字符),并写入文件myfile4.txt中,用-1作为字符串输入结束的标志,然后将文件的内容读出显示在屏幕上。文件的读写分别由自定义函数ReadText和WriteText实现。[注意] 部分源程序给出如下。请勿改动主函数main和其他函数中的任何内容,仅在函数fun的横线上填入所编写的若干表达式或语句。[试题源程序]include<stdio.h>include<string.h>include<stdlib.h>void WriteText(FILE *);void ReadText(FILE *);main(){FILE *fp;if((fp=fopen("myfile4.txt", "W"))==NULL){printf("open fail !!\n"); exit(0);}WriteText(fp);fclose(fp);if((fp=fopen("myfile4.txt", "r"))==NULL)printf("open fail !!1\n"); exit(0);}ReadText(fp);fclose(fp);}/*********found*********/void WriteText(FILE (1) ){char str[81];printf("\nEnter string with -1 to end :\n");gets(str);while(strcmp(Str, "-1")!=0){/**********found*********/fputs( (2) , fw);fputs("\n", fw);gets(str);}}void ReadText(FILE *fr){char str[81];printf("\nRead file and output to screen :\n");fgets(str, 81, fr);while( !feof(fr)){/**********found**********/printf("%s", (3) );fgets(str, 81, fr);}}

有以下程序: #includestdio.h main( ) {FILE*fp;char str[10]; fp=fopen("myfile,dat",""); {puts("abe",ip);fclose(fp); fp=fopen("myfile.dat","a*"); fprintf(fp,"%d",28); rewind(fp); fscanf(fp,"%S",str);puts(str); fclose(fp); } 程序运行后的输出结果是( )。A.abcB.28cC.abc28D.内类型不一致而出错

有以下程序include void WriteStr(char*fn,char*str){FILE*fp; fp=fopen(fn,"w");fpu 有以下程序 #include <stdio.h> void WriteStr(char *fn, char *str) { FILE *fp; fp=fopen(fn,"w"); fputs(str,fp);fclose(fp); } main() { WriteStr("t1.dat","start"); WriteStr("t1.dat","end"); } 程序运行后,文件t1.dat中的内容是A.startB.endC.startendD.endrt

有以下程序:includevoid WriteStr(char *fn, char *sir){FILE * fP; fP=fopen(fn,"w") 有以下程序: #include<stdio.h> void WriteStr(char *fn, char *sir) { FILE * fP; fP=fopen(fn,"w"); fput6(str,fp); fclose(fp); } main() { WriteStr("t1.dar","start"); WrlteStr("t1.dat","end"); } 程序运行后,文件t1.dat中的内容是( )。A.startB.endC.startendD.endrt

有以下程序 #include void WriteStr(char*fn,char*str) { FILE*fp; fp=fopen(fn,"w");fputs (str,fp);fclose(fp); } main() { WriteStr("t1.dat","start"); WriteStr("t1.dat","end"); } 程序运行后,文件t1.dat中的内容是______。A.startB.endC.startendD.endrt

有以下程序:include main(){FILE*fp;int i,k,n; fp=fopen("data.dar","w+");for(i=1;i 有以下程序: #include <stdio.h> main() { FILE *fp; int i,k,n; fp=fopen("data.dar","w+"); for(i=1;i<6;i++) { fprintf(fp,"%d ",i); if(i%3==0) fprintf(fp,"\n"); } rewind(fp); fscanf(fp,"%d%d",k,n); printf("%d%d\n",k,n); fclose(fp); } 程序运行后的输出结果是( )。A.0 0B.123 45C.1 4D.1 2

有以下程序include main(){FILE *fp;int i=20,j=30,k,n;fp=fopen("d1.dat","w");fprin 有以下程序 #include <stdio.h> main() { FILE *fp; int i=20,j=30,k,n; fp=fopen("d1.dat","w"); fprintf(fp,"%d\n",i);fprintf(fp,"%d\n",j); fclose(fp); fp=fopen("d1.dat", "r"); fp=fscanf(fp,"%d%d",k,n); printf("%d%d\n",k,n); fclose(fp); } 程序运行后的输出结果是A.20 30B.20 50C.30 50D.3020

有以下程序:include main( ){FILE * fp; int i,k,n;fp = fopen( "data. dat" ,"w +" ) 有以下程序:#include <stdlo.h>main( ){ FILE * fp; int i,k,n; fp = fopen( "data. dat" ,"w +" ) for(i = 1 ;i<6;i ++ ) { fprintf(fp."% d",i); if(i%3 ==0)fprintf(fp," \n"); } rewind(fp); fscanf(fp." % d% d" ,k, n) ;printf(" % d%d \n" ,k,n); fclose(fp);A.0 0B.123 45C.1 4D.1

有以下程序: include main() {FILE *fp; int i,k,n; fp=fopen("data 有以下程序: #include <stdio.h> main() {FILE *fp; int i,k,n; fp=fopen("data.dat","w+"); for(i=1;i<6;i++) {fprintf(fp,"%d ",i); if(i%3==0) fprintf(fp,"\n"); } rewind(fp); fscanf(fp,"%d%d",k,n); printf("%d %d\n",k,n); fclose(fp); } 程序运行后的输出结果是 ______。A.0 0B.123 45C.1 4D.1 2

有以下程序:include main()FILE *fp; int i,k=0,n=0;fp=fopen("d1.dat","w");for(i=l 有以下程序: #include <stdio.h> main() FILE *fp; int i, k=0, n=0; fp=fopen("d1.dat","w"); for(i=l;i<4;i++) fprintf(fp,"%d",i); fclose(fp); fp=fopen("d1.dat","r"); fscanf(fp,'%d%d",k,n); printf("%d %d\n", k, n); fclose(fp); 执行后输出结果是A.1 2B.123 0C.1 23D.0 0

有以下程序:includemain(){FILE*fp;int a[10]={1,2,3},i,n;fp=fopen("d1.dat","w");fo 有以下程序: #include<stdio.h> main() {FILE*fp;int a[10]={1,2,3},i,n; fp=fopen("d1.dat","w"); for(i=0;i<3;i++)fprintf(fp,"%d",a[i]); fprintf(fp,"\n"); fclose(fp); fp=fopen("d1.dat","r"); fscanf(fp,"%d",&n); fclose(fp); printf("%d\n",n); 程序的运行结果是( )。A.12300B.123C.1D.321

有以下程序includevoid WriteStr(char*fn,char*str){FILE*fp; fp=fopen(fn,"w");fputs 有以下程序 #include<stdio.h> void WriteStr(char*fn,char*str) { FILE*fp; fp=fopen(fn,"w");fputs(str,fp);fclose(fp); } main() { writeStr("t1.dat","start"); WriteStr("t1.dat","end"); } 程序运行后,文件t1.dat中的内容是A.startB.endC.startendD.endrt

有以下程序 include main() { FILE *fp1; fp1=fopen("f1.txt","w"); fprintf(fp1,"ab 有以下程序 #include <stdio.h> main() { FILE *fp1; fp1=fopen("f1.txt","w"); fprintf(fp1,"abc"); fclose(fp1); } 若文本文件f1.txt中原有内容为:good,则运行以上程序后,文件n.txt中的内容为______。A.goodabcB.abcdC.abcD.abcgood

有以下程序 include void WriteStr(char*fn,char*str) {FILE*fp; fp=f 有以下程序 #include<stdio.h> void WriteStr(char*fn,char*str) {FILE*fp; fp=fopen(fn"w");fputs(str,fp);fclose(fp); } main() { WriteStr("t1.dat"start"); WriteStr("t1,dat","end"); } 程序运行后,文件t1.dat中的内容是 ______。A.startB.endC.startendD.endrt

有以下程序includemain(){FILE *fp;int i=20,j=30,k,n;fp=fopen("d1.dat","w");fprint 有以下程序 #include<stdio.h> main() {FILE *fp;int i=20,j=30,k,n; fp=fopen("d1.dat","w"); fprintf(fp,"%d\n",i;fprintf(fp,"%d\n",j); fclose(fp); fp=fopen("d1.dat","r"); fscanf(fp,"%d%d",k,n);printf("%d%d\n",k,n); fclose(fp);} 程序运行A.20 30B.20 50C.30 50D.30 20

有以下程序:includemain(){ FILE*fp;int i;char ch[]="abcd",t;fp=fopen("abc.dat","w 有以下程序: #include <stdio.h> main() { FILE *fp; int i; char ch[]="abcd",t; fp=fopen("abc.dat","wb+"); for(i=0;i<4;i++)fwrite(ch[i]1,1,fp); fseck(fp,-2L,SEEK_END) ; fread(t,1,1,fp); felose(fp); printf("%c\n",t); } 程序执行后的输出结果是( )。A.dB.cC.bD.a

有以下程序: #includestdio.1l void WriteStr(char*fn.char*str) { FILE*fp; fp=fopen(fn,"w");fputs(str,fp);fclose(fp);} main { WriteStr("tl.dat","start"); WriteStr("t1.dat","end");) 程序运行后,文件t1.dat中的内容是( )。A. startB.endC.startendD.endrt

有以下程序:includestdio.1lvoid WriteStr(char*fn.char*str){ FILE*fp;fp=fopen(fn,stdio.1lvoid WriteStr(char*fn.char*str){ FILE*fp;fp=fopen(fn,w);fputs(str,fp);fclose(fp);}main{ WriteStr(tl.dat,start);WriteStr(t1.dat,end);)程序运行后,文件t1.dat中的内容是( )。A. startB.endC.startendD.endrt

有以下程序#inculde stdio.hmain(){ FILE*Fp;char str[10];Fp=Fopen(“myFile.dat”,”W”);Fputs(“aBc”,Fp);Fclose(Fp);Fp=Fopen(“myFile.dat”,”a+”);FprintFF(Fp,”%d”,28);reWind(Fp);FscanF(Fp,”%s”,str);puts(str);Fclose(Fp);}程序运行后的输出结果是A.aBcB.28cC.aBc28D.因类型不一致而出错

有以下程序: include main( ) { FILE *fp; int i=20,j=50,k,n; fp=fopen("d1.da 有以下程序: #include<stdi0.h> main( ) { FILE *fp; int i=20,j=50,k,n; fp=fopen("d1.dat","W"); fprintf(fp,"%d\n",i);fprintf(fp,"%d\n",j); fclose(fp); fp=fopen("d1.dat","r",); fscanf(fp,"%d%d",&k,&n); printf("%d%d\n",k,n); fclose(fp); } 程序运行后的输出结果是A.20 30B.20 50C.30 50D.30 20

对于如下程序:  #include    main( )  {    FILE *fp;    fp=fopen(“file.txt”,“w”);    fprintf(fp,“%s”,“xyz”);    fclose(fp);  }  若文件file.txt中原有的内容为good,则运行该程序以后,文件file.txt中的内容为()

单选题有以下程序:#include main(){ FILE *fp; int a[10]={1,2,3},i,n; fp=fopen(d1.dat,w); for(i=0;i3;i++) fprintf(fp,%d,a[i]); fprintf(fp,); fclose(fp); fp=fopen(d1.dat,r); fscanf(fp,%d,n); fclose(fp); printf(%d,n);}程序的运行结果是(  )。A12300B123C1D321

单选题以下程序:#include main(){ FILE *fp; char str[10]; fp=fopen(myfile.dat,w); fputs(abc,fp); fclose(fp); fp=fopen(myfile.dat,a+); fprintf(fp,%d,28); rewind(fp); fscanf(fp,%s,str); puts(str); fclose(fp);}程序运行后的输出结果是(  )。AabcB28cCabc28D因类型不一致而出错