(15)以下程序运行后的输出结果是 【15】 。#include stdio.hmain(){ FILE *fp; int x[6]={1,2,3,4,5,6},i;fp=fopen("test.dat","wb");fwrite(x,sizeof(int),3,fp);rewind(fp);fread(x,sizeof(int),3,fp);for(i=0;i6;i++) printf("%d",x[i]);printf("\n");fclose(fp);}
(15)以下程序运行后的输出结果是 【15】 。
#include <stdio.h>
main()
{ FILE *fp; int x[6]={1,2,3,4,5,6},i;
fp=fopen("test.dat","wb");
fwrite(x,sizeof(int),3,fp);
rewind(fp);
fread(x,sizeof(int),3,fp);
for(i=0;i<6;i++) printf("%d",x[i]);
printf("\n");
fclose(fp);
}
相关考题:
有以下程序#include stdio.hfun(int x){ if(x/20) f un(x/2);printf("%d ",x);}main(){ fun(6);printf("\n"); }程序运行后的输出结果是 【 1 5 】 。
有以下程序 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 k,n,a[6]={1,2,3,4,5,6}; f 有以下程序 #include<stdio.h> 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("d2.daf","r"); fscanf(fp,"%d%d",k,n);printf("%d%d\n",k,n); fclose(fp); } 程序运行后的输出结果是A.1 2B.1 4C.123 4D.123 456
有以下程序 include main() { FILE *fp;int i,a[6]={1,2,3,4,5,6}; fp= 有以下程序 #include<stdio.h> main() { FILE *fp;int i,a[6]={1,2,3,4,5,6}; fp=fopen("d3.dat","w+b"); fwrite(a.sizeof(int),6,fp); fseek(fp,sizeof(int)*3,SEEK_SET):/*该语句使读文件的位置指针从文件头向后移动3个int型数据*/ fread(a,sizeof(int),3,fp);fclose(fp); for(i=0;i<6;i++)printf("%d,",a[i]); } 程序运行后的输出结果是A.4,5,6,4,5,6,B.1,2,3,4,5,6,C.4,5,6,1,2,3,D.6,5,4,3,2,1,
以下程序运行后的输出结果是( )。 include main(){ int a=1, b=7; do { b=b/2; a+=b 以下程序运行后的输出结果是( )。include<stdio.h>main(){ int a=1, b=7;do {b=b/2; a+=b;} while(b>1);printf("%d\n",A);}
以下程序运行后的输出结果是 。includemain(){FILE*fp;int x[6]={l,2,3,4,5,6},i;fp=fopen(“test.dat”,”wb“);fwrite(x,sizeof(int),3,fp);rewind(fp);fread(x,sizeof(int),3,f}]);for(i=0;i6;i++)printf(“%d”,x[i]);printf(“\n”);fclose(fp);}
有以下程序: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 define F(X,Y) (X)*(Y) main( ) { int a=3, b=4; prin 有以下程序#include <stdio.h>#define F(X,Y) (X)*(Y)main( ){ int a=3, b=4;printf("%d\n", F(a++, b++));}程序运行后的输出结果是A.12B.15C.16D.20
有以下程序:include main() {int a[] = {2,4,6,8,10} ,y =0,x, * p;p =a[1];for( 有以下程序: #include <stdio.h> main() { int a[] = {2,4,6,8,10} ,y =0,x, * p; p =a[1]; for(x=1;x<3;x++)y+ =p[x]; printf( "% d \n" , y); }程序运行后的输出结果是( )。A.10B.11C.14D.15
有以下程序:include using namespace std;int main (){int x=15;while (x>10 int main () { int x=15; while (x>10x<50) { x++; if (x/3) { x++; break; } } cout<<x<<endl; return 0; } 执行后的输出结果是A.15B.16C.17D.18
有以下程序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 有以下程序: #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
有以下程序include main(){FILE*fp;inti,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 ",1); 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
有以下程序includemain(){int a=5,b=lt; t=(a 有以下程序 #include<stdio.h> main() { int a=5,b=lt; t=(a<<2)|b;printf("%d\n",t); } 程序运行后的输出结果是______。A.21B.11C.6D.1
以下程序运行后的输出结果是( )。 include main() { int x=20; printf("%d", 0 以下程序运行后的输出结果是( )。include<stdio.h>main(){ int x=20;printf("%d", 0<x<20);printf("%d\n", 0<x x<20);}
有以下程序 include main( ) { FILE *fp; int i,k=0,n=0; fp=fopen(“d1.dat”, 有以下程序 #include <stdio.h> main( ) { 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%d”,k,n); printf(“%d %d\n”,k,n); fclose(fp);} 执行后输出结果是( )A.1 2B.123 0C.1 23D.0 0
有以下程序 include main() { FILE*fp;int i,k=0,n=0; fp=fopen("d1.dat","w"); for(i 有以下程序 #include<stdio.h> main() { FILE*fp;int i,k=0,n=0; fp=fopen("d1.dat","w"); for(i=1;1<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 2 3D.1 23
有以下程序:includeusing namespace std;int main(){int x=15;while(x>10x 有以下程序: #include<iostream> using namespace std; int main() { int x=15; while(x>10x<50) { x++; if(x/3) { x++;break; } } cout<<x<<endl; return 0; } 执行后的输出结果是( )。A.15B.16C.17D.18
有以下程序 include main( ) { FILE *fp;int i,a[6]={1,2,3,4,5,6}; fp=fopen("d3.da 有以下程序#include <stdio.h>main( ){ FILE *fp;int i,a[6]={1,2,3,4,5,6};fp=fopen("d3.dat","w+b");fwrite(a,sizeof(int),6,fp);fseek(fp,sizeof(int)*3,SEEK_SET);/*该语句使读文件的位置指针从文件头向后移动3个int型数据*/fread(a,sizeof(int),3,fp);fclose(fp);for(i=0;i<6;i++)printf("%d,",a[i]);}程序运行后的输出结果是A.4,5,6,4,5,6,B.1,2,3,4,5,6,C.4,5,6,1,2,3,D.6,5,4,3,2,1,
有以下程序:include using namespace std;int main() {int x=15;while(x>10 int main() { int x=15; while(x>10x<50) { x++; if(x/3) { x++; break; } } cout<<x<<end1; return 0; } 执行后的输出结果是A.15B.16C.17D.18
有以下程序: 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 define F(X,Y)(X)*(Y)main(){int a=3,b=4;printf("%d\n",F(a++,b 有以下程序: #include <stdio.h> #define F(X,Y)(X)*(Y) main() { int a=3,b=4; printf("%d\n",F(a++,b++)); } 程序运行后的输出结果是( )。A.12B.15C.16D.20
下列程序运行后的输出结果是()。 include void fun(int,int,int*); void main() { i 下列程序运行后的输出结果是( )。 #include<iostream.h> void fun(int,int,int*); void main() { int x,y,z; fun(5,6,x); fun(7,x,y); fun(x,y,z); cout<<x<<","<<y<<","<<z<<end1; } void fun(int a,int b,int *c) { b+=a; *c=b-a; }A.5, 5, 5B.6, 6, 6C.5, 6, 7D.7, 7, 7
有以下程序includemain(){FILE *fP;int k,n,a[6]={1,2,3,4,5,6}; fp=fopen ("d2.dat", 有以下程序 #include<stdio.h> 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("d2.dat","r"); fscanf(fp,"%d%d",k,n);printf("%d%d\n",k,n); fclose(fp); } 程序运行后的输出结果是。A.1 2B.1 4C.123 4D.123 456
单选题有以下程序:#include main(){ FILE *fp; int i,a[6]={1,2,3,4,5,6},k; fp=fopen(data.dat,w+b); fprintf(fp,%d,a[0]); for(i = 1;i 6;i++) { rewind(fp); fprintf(fp,%d,a[i]); } rewind(fp); fscanf(fp,%d,k); fclose(fp); printf(%d,k);}程序运行后的输出结果是( )。A6B21C123456D654321
单选题有以下程序:#include main(){ FILE *fp; int i,a[6]={1,2,3,4,5,6},k; fp=fopen(data.dat,w+b); fwrite(a[0],sizeof(int),1,fp); for(i = 1;i 6;i++) { fseek(fp,0L,0); fread(k,sizeof(int),1,fp); fseek(fp,0L,0); a[i]+=k; fwrite(a[i],sizeof(int),1,fp); } rewind(fp); fread(k,sizeof(int),1,fp); fclose(fp); printf(%d,k);}程序的运行结果是( )。A21B6C123456D11